Problem building extension under Cygwin (ImportError: Bad address)

Lars larswarholm at
Thu May 4 15:23:23 CEST 2006

Thanks Jason, it works now.

There seems to be some sort of issue with ld in cygwin when compiling
shared libraries (e.g. DLL's).
This worked on my Cygwin installation also:

gcc hello.c -I/usr/include/python2.4/ -L/usr/lib/python2.4/config/
-lpython2.4 -shared -o hello.dll
(gives the right answer)

But first compiling hello.c with gcc, then linking it with gnu-ld just
won't work. I only really need to compile one C-file to a shared
library so it doesn't matter so much for me. But bigger projects will
have a problem..

gcc -c hello.c -I/usr/include/python2.4/
ld -shared hello.o -o -L /usr/lib/python2.4/config -lpython2.4
Traceback (most recent call last):
  File "", line 1, in ?
    import hello
ImportError: Bad address


More information about the Python-list mailing list