[C++-sig] linking with non-python libraries

Ben Veal benveal92 at hotmail.com
Tue Feb 7 03:07:58 CET 2006


Hi,
I am trying to build a python extension for a derived class whose base class 
I only have as a shared library object & declaration file.
The base class contains many virtual functions of which I only need a few, 
and also involves some threading. It contains various functions for getting 
data from a remote server.
I manage to build the extension OK (both manually and using pyplusplus), 
however when I try to import it, I get the following message:

ImportError: /usr/lib/python2.3/MyClient.so: undefined symbol: 
_ZN8BaseClassC2ERKS_

I suppose it can't find the library containing the base class. I use the 
following lines in my Jamfile to link with the appropriate libraries:

extension DerivedClass
:
     sourcefile.cpp
     <template>@boost/libs/python/build/extension
:    <include>/usr/include/BaseClassDir
     <library-file>/usr/lib/BaseClass.so
     <lib>/usr/lib/pthread
     <define>__LINUX
;

Is is possible to link to a non-python library from a python module?
If so, what am I doing wrong (surely something simple?).
If I manage to get over this linking hurdle, is it likely that I will be 
able to get my extension to work with all the threading?

Thanks.





More information about the Cplusplus-sig mailing list