Problem building extension under Cygwin (ImportError: Bad address)
Jason Tishler
jason at tishler.net
Thu May 4 08:16:10 EDT 2006
Lars,
On Thu, May 04, 2006 at 03:50:13AM -0700, Lars wrote:
> 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.
>
> [snip]
The following works for me:
$ gcc -shared -I/usr/include/python2.4 -o hello.dll hello.c -L/usr/lib/python2.4/config -lpython2.4
$ python -c'import hello;q = hello.message("Lars");print q'
Hello, Lars
$ python hellouse.py
Hello, C
Hello, module /tmp/Examples/PP2E/Integrate/Extend/Hello/hello.dll
Hello, 0
Hello, 1
Hello, 2
Note I had to apply the attached patch to get hello.c to compile.
Jason
--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
--- hello.c.orig 2006-05-04 08:06:06.769910400 -0400
+++ hello.c 2006-05-04 08:06:10.988633400 -0400
@@ -25,7 +25,7 @@
{"message", message, 1}, /* method name, C func ptr, always-tuple */
{NULL, NULL} /* end of table marker */
};
-,
+
/* module initializer */
void inithello() /* called on first import */
{ /* name matters if loaded dynamically */
More information about the Python-list
mailing list