Embedding Python in an application plug-in ( .so )

bEngO foolscreen at gmail.com
Wed Aug 23 01:07:37 EDT 2006


Dear all,

When embedding we must link with the python library AND USE -rdynamic OR
-Wl,-export-dynamic OR -Xlinker -export-dynamic
to export ALL symbols from the Python library even if we do not use all of
them.
This is needed when the embedded Python import modules to avoid undefined
symbol errors.

But it doesn't work when embedding Python into a plug-in ( .so ) for an
application.
I want to embed Python in a shared object which will be dynamically loaded
by an application.
So when i build my share object, i link with the python library ( btw should
i link with the .a or .so ? )
and i use the flag to export all symbols and Python is accessible from the
application when my share object is loaded.
But i can't import Python modules ( example: import socket ), i get some
undefined symbols errors.

I dont know exactly why.
Is it because the rdynamic/export-dynamic flags have no effect when building
a shared object ?
Or is it a problem with my compiler: GCC 4.1.0, Linux 2.6.17 ?
Or is it because the application is loading my plug-in without the
RTLD_GLOBAL flag ?
Or what ?

Please help :)
I found some people having the same problem but no workaround...

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060823/463a331d/attachment.html>


More information about the Python-list mailing list