Note that there are some explanatory texts on larger screens.

plurals
  1. POpython_x64 + C library compiled with mingw_x64 on Windows7 Py_InitModule4
    primarykey
    data
    text
    <p>I'm trying to compile C library for python on Windows7 (64-bit) using mingw-x64. It all worked like a charm with 32-bit versions.</p> <p>I used to compile my library with gcc -shared -IC:\Python27\include -LC:\Python27\libs myModule.c -lpython27 -o myModule.pyd</p> <p>and it worked with 32-bit versions. The same procedure is working with 64-bit linux. But on 64-bit windows7 (using 64-bit x86_64-w64-mingw32 and 64-bit python 2.7.5) I have a problem:</p> <pre><code>C:\Users\sergej\AppData\Local\Temp\cci8TbXw.o:myModule.c:(.text+0x267): undefined reference to `__imp_Py_InitModule4' collect2: ld returned 1 exit status </code></pre> <p>I checked C:/Python27/libs/modsupport.h and it already contains</p> <pre><code>#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 #endif </code></pre> <p>I'm currently out of ideas what to do. Any suggestion? The C code is not an issue here. I have the same problem with example from <a href="http://csl.name/C-functions-from-Python/" rel="nofollow noreferrer">http://csl.name/C-functions-from-Python/</a><br> Note - typo in line 26 in this example: should be VARARGS</p> <p>And yes - I did found (similar to <a href="https://stackoverflow.com/questions/11182765/how-can-i-build-my-c-extensions-with-mingw-w64-in-python">How can I build my C extensions with MinGW-w64 in Python?</a> question ) that I can compile this trivial example by adding -DMS_WIN64 to gcc line, but I still got the similar errors in my real program (suggesting there is more to it)</p> <pre><code>undefined reference to `__imp_PyArg_ParseTuple' undefined reference to `__imp_Py_BuildValue' undefined reference to `__imp_Py_InitModule4_64' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload