Python as shared library on Unix

Rolf Kalbermatter r.kalbermatter at
Wed Sep 18 16:48:58 EDT 2002

I'm currently in the process of porting a Python embedding from
Windows to Linux and have come across an appearent problem.

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 or similar to link my application
to with the dl* functions.

My question is if I have overlooked some option in ./configure or
somewhere else or if this is not possible out of the box? If it is
not available as a standard, what are the changes to get it working
by modifying the ./configure and or Makefile scripts?

I read in the documentation that under Windows one needs to link to
the DLL in order to have dynamic module loading available, for the
Mac OS X part there where some adjustments in the past to make sure
that sys.executable was pointing to the user executable instead of
the shared module. I could think of several such pitfals which could
show up when creating a Linux shared library.

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.

Rolf Kalbermatter

More information about the Python-list mailing list