Python as shared library on Unix
Martin v. Loewis
martin at v.loewis.de
Wed Sep 18 17:27:49 EDT 2002
"Rolf Kalbermatter" <r.kalbermatter at hccnet.nl> writes:
> Under Windows I have linked my app dynamically to the pythonXX.dll using
> LoadLibrary/GetProcAddress and that works very nicely. Under Linux I see
> no option to build a python.so.2.2.1 or similar to link my application
> to with the dl* functions.
I recommend that you not use a shared library. Instead, just link
libpython2.2.a to your application.
> My question is if I have overlooked some option in ./configure or
> somewhere else or if this is not possible out of the box?
It's not possible out of the box. Python 2.3 will support that.
> If it is not available as a standard, what are the changes to get it
> working by modifying the ./configure and or Makefile scripts?
You can backport the changes from 2.3 if you want to.
> I can of course always link the Python core into my application which
> by the way is a shared library itself which is loaded dynamically
> into the main application but coming from the Windows world, this
> seems kind of unelegant to me.
I think linking the static library is more elegant. It reduces the
external dependencies, and thus the number of problem sources, in your
application. It also increases performance.
More information about the Python-list