swig-python -> shared (vs) static libraries

abarun22 at gmail.com abarun22 at gmail.com
Mon Oct 29 16:03:03 EDT 2007


HI
I am new to SWIG & Python and right now i am in the process of
wrapping some "C" functionalities present in a static library for
python. I do have my C file "name.c" which just contains some helper
functions.
I tried to link my object files (e.g name.o & name_wrap.o) with the
static libraries (whose functionalities need to be wrapped) to form a
shared library that can be imported from Python. While doing so i
cannot be able to access the C data structure from Python and i got
all values as zero. I work in Linux gcc version.
I created my shared object like this:
ld -G name.o name_wrap.o -o _name.so -Bstatic -lfoo1 -lfoo2 -lfoo3.
On the other hand to dig more in to this i tried to simulate the
static libraries with simple dummy code in my file "name.c" so that i
can avoid linking the static libraries. This case i could be able to
retrieve the vaues of the data structure. I wonder if the problem
could be due to linking of the static libraries to create the shared
object.
Any body experienced the same problem or having related ideas pls help
me.
Best regards
Arun




More information about the Python-list mailing list