swig cygwin python

Marcin Matuszkiewicz marcinm at finisar.com
Tue Sep 4 20:01:11 EDT 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
-lpython2.1.dll
example_wrap.o(.text+0x1e6):example_wrap.c: undefined reference to
`PyExc_NameEr
ror'
example_wrap.o(.text+0x2b8):example_wrap.c: undefined reference to
`PyExc_NameEr
ror'
example_wrap.o(.text+0x305):example_wrap.c: undefined reference to
`PyType_Type'
example_wrap.o(.text+0xef0):example_wrap.c: undefined reference to
`PyExc_TypeEr
ror'
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,
Marcin



More information about the Python-list mailing list