python - undefined reference to `_imp__PyExc_TypeError' with MinGW -


i compiling c dll in windows mingw using following instructions:

"c:\gnat\2015\bin\gcc.exe" -shared -c -ic:\python27\include *.c "c:\gnat\2015\bin\gcc.exe" -shared -wall -o3 -ic:\python27\include -l./ -l dependency_lib -lc:\python27\libs *.o -o mylib.pyd -lpython27  

i several of these errors during linking:

(.text+0x5a2): undefined reference `_imp__pyexc_typeerror' (.text+0x69f): undefined reference `_imp___py_nonestruct' 

i tried converting .lib .a get:

/libpython27.a: file format not recognized; treating linker script 

any idea of doing wrong? lot

it looks mingw compiler needs python27.a , not python27.lib. however, the way .lib generated important. me, way worked was:

  1. get python27.dll. got "c:\gnat\2015\bin\python27.dll". may in "windows/system32".
  2. generate .def file pexport. forget other options using sed did not worked me. run pexports.exe python27.dll > python27.def
  3. use dlltool mingw: dlltool --dllname python27.dll --def python27.def --output-lib libpython27.a

  4. place generated libpython27.a in c:\python27\libs , don't forget add path gcc command -lc:\python27\libs

note: -lpython27 option in gcc must @ end.

source


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -