Loading shared modules from an imbedded interpreter
Oleg Broytmann
phd at emerald.netskate.ru
Sun Aug 29 05:56:18 EDT 1999
On Sat, 28 Aug 1999, Dave Wallace wrote:
> I am attempting to embed Python in a c executable, unfortunately
> when I attempt to import a shared-c module or a Python module that
> imports a shared-c module, I get errors like:
>
> Traceback (innermost last):
> File "<string>", line 1, in ?
> ImportError: /usr/local/lib/python1.5/lib-dynload/selectmodule.so:
> undefined symbol: _Py_NoneStruct
>
> where the undefined symbol varies from file to file. Apparently, when
> compiling parts of libpython are left out since they are not referenced
> by my code. Is there any way to force them to be included?
>
> Thanks,
> Dave
> dwallace at netgsi.com
You need to export these symbols from main program back to extensions.
The actual linker option is compiler/linker dependent. If you use gcc give
it the -Wl,-E option. With this gcc pass -E option down to linker.
"man ld" for detailed technical description on -E.
I stuck the problem when compiled PyApache - I can't load an extension.
PyApache mailing list gave me the advice on using -E - and now all go well!
Oleg.
----
Oleg Broytmann Netskate/Inter.Net.Ru phd at emerald.netskate.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list