Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SWIG/Python on Windows

1 view
Skip to first unread message

DD

unread,
Nov 2, 2001, 2:47:53 PM11/2/01
to
Has anybody used SWIG with Python on Windows without Microsoft Visual
C++? I'm having problems getting the hellolib example in the
Extending Python chapter from "Programming Python" to compile with
gcc. I'm getting undefined reference errors to "Py..." functions, ex:
PyString_FromString. All the examples I can find on the web use MSVC
and I can't find an example for compiling a DLL using a makefile.

BTW: Has anybody on this list done an integration between Perforce
and PVCS Tracker? The above issue is holding me up from using P4DTI,
which otherwise looks like a decent solution.

thanks,
DD

Gerhard Häring

unread,
Nov 2, 2001, 2:10:16 PM11/2/01
to
On Fri, Nov 02, 2001 at 11:47:53AM -0800, DD wrote:
> Has anybody used SWIG with Python on Windows without Microsoft Visual
> C++? I'm having problems getting the hellolib example in the
> Extending Python chapter from "Programming Python" to compile with
> gcc. I'm getting undefined reference errors to "Py..." functions, ex:
> PyString_FromString.

> All the examples I can find on the web use MSVC and I can't find an
> example for compiling a DLL using a makefile.

Madness lies down that path. I'd recommend you enter the beautiful land
of Python distutils instead. Building an extension on Windows is
relatively painless then.

First, you need to create an import library for gcc. Have a look at the
HOWTO I posted here in August on how to do this and other useful tips
for developing and debugging on Windows with gcc:

http://mail.python.org/pipermail/python-list/2001-August/061125.html

- write a setup.py for it
- "python setup.py build --compiler=mingw32" (or install, or even
bdist_wininst)

As for the SWIG part of your problem, I'd just create the .c and .h
files for setup.py, then use python setup.py to build. I remember having
seen SWIG integration with distutils somewhere, but don't remember
where.

Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

0 new messages