[BangPypers] import error undefined symbol: Py_InitModule4
dileep.ds at gmail.com
Fri Jan 11 10:24:41 CET 2013
I am working on cython code and after compilation I am getting the above
import error with compiled .so file. I am using python 2.4 and testing on a
64 bit machine. I think
the issue happened because calling python interpreter and the extension do
not use the same version.(one is Python 2.4, the other 2.5).
As per PEP0353 (http://www.python.org/dev/peps/pep-0353/ ) there is a name
change for 64 bit machines.To prevent loading extension modules that assume
a 32-bit size type into an interpreter that has a 64 bit size type,
Py_InitModule4 is renamed to Py_InitModule4_64.
By adding the below lines of code to my extension .c file will fix that
issue ? any one faced similar issue ?
#if SIZEOF_SIZE_T != SIZEOF_INT
/* On a 64-bit system, rename the Py_InitModule4 so that 2.4
modules cannot get loaded into a 2.5 interpreter */
#define Py_InitModule4 Py_InitModule4_64
More information about the BangPypers