Problem building extension under Cygwin (ImportError: Bad address)
larswarholm at gmail.com
Thu May 4 12:50:13 CEST 2006
I have problems building a simple handcoded C-extension (hello.c) with
Cygwin and gcc3.4.4. I hope somebody has encountered the same problem
before, and has some advice.
The extension works just fine with Linux:
gcc -c hello.c -I/usr/local/include/python2.4/
ld -shared hello.o -o hello.so -L /usr/local/lib/ -lpython2.4 -lc
python -c'import hello;q = hello.message("Lars");print q'
But doing a similar compile under Cygwin doesn't work so well:
(same options, but the output is called hello.dll and the directories
are a bit different)
$ python -c"import hello"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: Bad address
hello.c is from "Programming Python 2nd ed." by Mark Lutz. It's
published by O'Reilly. The code can be downloaded from:
hello.c is in the directory PP2E\Integrate\Extend\Hello.
More information about the Python-list