static program including python interpreter + dynamic python extensions

Tim Fuehner fuehner at iisb.fraunhofer.de
Mon Dec 8 14:27:30 CET 2003


Dear Newsgroup,

I have a problem that is somewhat related to Alexandre Gillet's ones:
"build a static python executable".

I would like to make a C[++] program scriptable. Therefor, I have included
a python interpreter into the program. Additionally I have wraped all the
program's interfaces that I need, using SWIG. Finally, I have created a
shared library, which includes this interface and all functions that are
to be available from within python scripts. And it works: one can write
a script, which can access the program's routines and data, the main
program correctly loads them, using its python interpreter.

However, the program has to be linked dynamically. Once I try to change
the main program's linkage to static, loading any module, that is not a
plain python file (but a shared library), fails, saying:
 Fatal Python error: Interpreter not initialized (version mismatch?)

Since I need the program to be linked statically, I would appreciate any
hint on how to fix this problem.
I'm using gcc 3.2 under linux (2.4.19) and python 2.3.2 (also checked with
2.2).

Thanks

-tim




More information about the Python-list mailing list