swig cygwin python

Marcin Matuszkiewicz marcinm at finisar.com
Wed Sep 5 02:01:11 CEST 2001

I am using swig to generate a wrapper around C functions I want to
call from python.  I am using gcc2.95.3-5 (cygwins pecial) and python
2.1 that come with cygwin.  I have a linker problem when creating .so
file.  Here are the details.
$ swig -python example.i
Generating wrappers for Python
$ gcc -c example.c
$ gcc -I/usr/include/python2.1 -c example_wrap.c
$ gcc -shared example.o example_wrap.o -L/lib/python2.1/config
example_wrap.o(.text+0x1e6):example_wrap.c: undefined reference to
example_wrap.o(.text+0x2b8):example_wrap.c: undefined reference to
example_wrap.o(.text+0x305):example_wrap.c: undefined reference to
example_wrap.o(.text+0xef0):example_wrap.c: undefined reference to
collect2: ld returned 1 exit status
$ nm /lib/python2.1/config/libpython2.1.dll.a | grep NameError
00000000 I __imp__PyExc_NameError
Does anyone know what is going on and/or how to fix it?
Thank you,

More information about the Python-list mailing list