Extension with MinGW

Andrew Gregory andrew.gregory at npl.co.uk
Tue Dec 3 13:22:29 EST 2002


I've just tried compiling a Python extension using MinGW. Found
import _pysimple
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
ImportError: DLL load failed: The specified module could not be found.

Based on the instructions at
http://starship.python.net/crew/kernr/mingw32/Notes.html

I compiled /linked using
gcc -L"C:\Python22\include" -c pysimple_wrap.c -DBUILDING_DLL=1

dllwrap --output-def lib_pysimple.def --implib lib_pysimple.a
pysimple_wrap.o /
-L"c:/python22/libs" -lpython22 --driver-name gcc -s --entry
_DllMain at 12 /
--target=i386-mingw32 --def _pysimple.def -o _pysimple.pyd

File pysimple.h is
extern int mysquare(int i)
{
  return i*i;
};

pysimple_wrap.c is created using SWIG 1.3.16

File _pysimple.def is
LIBRARY _pysimple.pyd
EXPORTS
init_pysimple


I didn't load any patches (used gcc 3.2). It works ok with Borland
5.5.
Any ideas?



More information about the Python-list mailing list