building extensions for Windows Python

JW wilson1442 at bellsouth.net
Fri Oct 13 17:39:25 CEST 2006


I have a lousy little Python extension, generated with the generous help
of Pyrex.  In Linux, things are simple.  I compile the extension, link it
against some C stuff, and *poof*! everything works.

My employer wants me to create a Windows version of my extension that
works with the vanilla Python 2.5 from python.org.

My employment contract states that I won't be required to run Windows, and
I desperately want to honor that clause. Ideally,  I'd somehow MinGw cross
compile like I do with C/C++ and *poof*!, out would pop a file I could
hand out to someone who wanted to "import <my_lousy_extension>".

In Windows, things aren't so simple.  I'm immediately bedazzled by a vast,
unfamiliar nomenclature: "VC6", "VC7.1", "msvcrt", "msvcr71", "msvcr80",
"VS2005", "VS2007", "MSVC2003", "MSVC2005", "Express Edition", ".NET SDK",
etc. 

The python.org "recommended compiler" is apparently no longer
available, but someone posted a link to an obscure Microsoft webpage
artifact where it could still be obtained.  Running it under WINE is less
than ideal, but I decided to try and make it work.  However, when I tried
installing the compiler, it failed because my "Internet Explorer [was] out
of date."  I'm not sure how IE comes into the picture, but I'm just a
programmer, after all.

I am further confused by the python.org docs on using MinGw to build
extensions:  "These instructions only apply if you're using a version of
Python prior to 2.4.1 with a MinGW prior to 3.0.0", but further on:
"pcexports python25.dll >python25.def" seems to contradict that.  It
really makes no difference.  The referenced webpage where the "pcexports"
tool is found seems defunct.

My main problem is that I don't really grasp the big picture.  Can someone
give me an overview of the requirements to build extensions for Windows
Python, circa 2.5?  Or, can I tell my employer she'll just have to
hire/contract a Windows expert to do the mud wrestling?

Jim Wilson
Gainesville, FL



More information about the Python-list mailing list