Python embedding & question about autoconf and dynamic linking
t at chabry.caltech.edu
Sat Sep 29 18:32:30 CEST 2001
In article <mailman.1001714851.11810.python-list at python.org>,
Mads Bondo Dydensborg <madsdyd at challenge.dk> wrote:
>I am trying to use Python as an embedded interprenter. Whilst it is quite
>easy to understand the C interface, I have found it _very_ hard to figure
>out what flags I need to pass to the linker to get a succesfull
>compile. It seems to depend rather heavily on a lot of parameters.
>So, my first question is if there are any autoconf macros out there that
>will work for me, sort of like a AM_PATH_SDL macro? I have been searching
>around, and found one from on of the KDE libs, but it seems to break
>rather quickly for everything else than Python 1.5 (which it seems to be
>only partly succesfull in anyway).
I haven't found one in distutils, either, which seems like a natural
place for them.
Please let me know if you get a list sent to you privately; I'm very
interested in this for 'configure'ing PyWX...
>My next question is with respect to dynamicly linking to the python
>interprenter, when embedding it. All info I have been able to find, points
>towards linking statically with libpython.<version>.a - however, this adds
>about 660KB to my application, and in general I would much rather link to
>a .so file - but I have not been able to find "such a beast" or
>instructions on how to build one. Is it possible? Or is there a clever
>way arond this kind of problem that I - beeing a clueless newbee - have
>totally overlooked? (Maybe some weird extension trickery?)
There used to be an explicit FAQ entry on this, in
entry 3.11 or thereabouts. It's gone now ;(. For older versions,
you should be able to do something like this:
ar xv ../libpython.a
gcc -shared -o ../libpython.so *.o
More information about the Python-list