On 17 Aug 2010 at 14:20, David Aldrich wrote: > I would be grateful for some help with setting up some makefiles for my > C++ application, compiled with gcc under Linux, that uses Boost.Python.
I would strongly recommend that you use something more modern than GNU make. Boost's build system is much better. The one I use is scons (http://www.scons.org/) whose only main fault is O(N^2) scaling to source file number, a problem they are in the process of fixing. Scons has the *major* advantage of its build config being python source. So its SConstruct and SConscript files are literally straight python. > Now I want to move Py_Initialize() to my main() function, and invoke the > Python interpreter from the shared library as before. So I linked the > application to the Python and Boost libraries in my top level makefile, > and deleted mention of the Python and Boost libraries from the shared > library's makefile. The result all links without errors but the Python > calls do nothing. Each thing which uses python ought to separately link to python and Boost.Python if necessary. You then leave the runtime linker figure it all out. If you were using scons or make, have a separate build config per DLL i.e. each DLL/shared object is a separate project. If you're using dlopen() to load these libraries at runtime make SURE you use RTLD_GLOBAL, otherwise you'll get multiple copies of BPL and python and it won't work. > If I use Boost.Python in a shared library, do I have to link > Boost.Python to it when I build it, or would linking Boost.Python to the > main application be sufficient? I think the command on Linux for checking what libraries link to what is 'ldd'. Use on each shared library to ensure its individual dependencies are satisfied. HTH, Niall -- Technology & Consulting Services - ned Productions Limited. http://www.nedproductions.biz/. VAT reg: IE 9708311Q. Company no: 472909. _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig