undefined symbols when embedding python

Martin v. Loewis martin at v.loewis.de
Thu Feb 14 03:51:37 EST 2002


landshark at verticaladdiction.net (Dave Marotti) writes:

> However, when I try to run my C++ program which contains the embedded python
> interpretor, any call which imports my wrapped C++ class causes undefined
> symbols:
> 
> ImportError: ./libtestwrapc.so: undefined symbol: Py_InitModule4

I take it that the extension module is in a shared library? (which is
kind of surprising, because in an embedded application, you'ld
normally want all extension modules to be linked into the application,
instead of having them as separate files on disk).

I also take it that you use GCC on Linux? In that case, you need to
export the symbols from the executable to the shared library, using
-Wl,--export-dynamic (see ld(1) for details).

Of course, this problem would also go away if you would incorporate
the extension into the application.

Regards,
Martin




More information about the Python-list mailing list