Problem building extension under Cygwin (ImportError: Bad address)

Lars larswarholm at gmail.com
Thu May 4 09:23:23 EDT 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
python hellouse.py
(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 hello.so -L /usr/lib/python2.4/config -lpython2.4
-lc
python hellouse.py
Traceback (most recent call last):
  File "hellouse.py", line 1, in ?
    import hello
ImportError: Bad address
-------------------------------------------

-Lars




More information about the Python-list mailing list