swig-python -> shared (vs) static libraries

Discussion in 'Python' started by abarun22@gmail.com, Oct 29, 2007.

  1. Guest

    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
     
    , Oct 29, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    6,516
    Maett
    May 16, 2005
  2. tropos
    Replies:
    3
    Views:
    466
  3. barcaroller
    Replies:
    1
    Views:
    315
    Ian Collins
    Jun 12, 2007
  4. Replies:
    0
    Views:
    560
  5. guxiaobo1982
    Replies:
    0
    Views:
    63
    guxiaobo1982
    Jul 15, 2013
Loading...

Share This Page