[Numpy-discussion] Compiling for free on Windows32

Sturla Molden sturla@molden...
Fri Apr 17 03:46:28 CDT 2009

On 4/15/2009 6:44 PM, Matthieu Brucher wrote:

> There is a Python limitation for the compiler. 

There is a common misunderstanding that only VS2003 can be used to 
compile extension objects for Python 2.5. Don't believe it. There is no 
Python limitation for the compiler.

There is a Python limitation for the C runtime (crt), but only if you 
share crt objects with Python. That is, if you e.g. open a FILE* pointer 
in C, create a Python file object from the pointer, and then read that 
file in Python. In this case Python would do a fread on the pointer, and 
it is your responsibility to make sure the same crt DLL does the fopen, 
fread and fclose.

If you don't share any crt resources with Python, there is no limitation 
on the crt either. If you do a malloc and a corresponding free in C, it 
does not matter what crt you use. It may even be used by Python objects 
in the meanwhile.

mingw (gcc, gfortran) can be used freely, and afaik is used to compile 
the official NumPy and SciPy releases for Windows. The gfortran team has 
made a binary installer for version 4.4 available in their Wiki.

When using mingw you have to link with the the same crt as Python if crt 
resources are shared. That is -lmsvcr71 for Python 2.5 and -lmsvcr90 for 
Python 2.6. If crt resources are unshared, link with whatever crt you want.

Sturla Molden

More information about the Numpy-discussion mailing list