building extensions for Windows Python

JW wilson1442 at bellsouth.net
Tue Oct 17 13:38:31 EDT 2006


Thanks to Michael and Nick, I can now cross-compile my Pyrex extensions
for bog-standard Python 2.5.  As I stumbled around in the dark trying to
bump into a solution, I was bolstered by the belief that at least two
other people had found the light at the end of the tunnel.

I had been using a crufty old prebuilt MinGW that linked to MSVCRT.DLL but
didn't include support for the newer VC runtime DLLs.  I had to build the
current version which adds support for MVCR71 (used by Python 2.5) and
MSVCR80 (used by Microsoft's current ".NET" offering).

(Note: The build script proffered by mingw.org fails really cryptically if
you don't have the scanner tool, "flex", installed.  But that's another
story.  After some hand-to-hand combat, I had a working MinGW, nee GCC
3.4.2.)

Microsoft advises that it's very bad mojo to mix calls to MSVCRT.DLL and
MSVCR71.DLL in one application, but http://tinyurl.com/ydndnn (or a page
it references) advises how to avert such a disaster with a simple change
to MinGW's "spec" file (which I never knew existed).

The upshot is that I can now use Linux to cross-build my extension for
Windows, and my preliminary testing (under WINE -- See the original post.
I must adhere to my employment contract!) seems to show that it works. 

Had I not known someone else claimed success, I would have thrown up my
hands in frustration.

Jim Wilson
Gainesville, FL




More information about the Python-list mailing list