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. Advertisements

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:
    7,113
    Maett
    May 16, 2005
  2. Helmut Zeisel

    Q: Static extension of Python using SWIG

    Helmut Zeisel, Jun 17, 2004, in forum: Python
    Replies:
    0
    Views:
    794
    Helmut Zeisel
    Jun 17, 2004
  3. tropos
    Replies:
    3
    Views:
    590
  4. barcaroller
    Replies:
    1
    Views:
    439
    Ian Collins
    Jun 12, 2007
  5. Replies:
    0
    Views:
    627
  6. Alf P. Steinbach /Usenet
    Replies:
    10
    Views:
    745
    sturlamolden
    Jul 13, 2010
  7. Replies:
    1
    Views:
    280
    Terry Reedy
    Mar 8, 2013
  8. guxiaobo1982
    Replies:
    0
    Views:
    145
    guxiaobo1982
    Jul 15, 2013
Loading...