Pyrex installation on windows XP: step-by-step guide

Robert Kern robert.kern at gmail.com
Sun May 21 21:40:03 EDT 2006


sturlamolden wrote:
> sturlamolden wrote:
> 
>>I don't think this is safe. MinGW links with msvcrt.dll whereas the
>>main Python distribution links with msvcr71.dll (due to Visual C++
>>2003).
> 
> In order to make minGW link with msvcr71.dll, edit the text file
> 
> c:\mingw\lib\gcc\mingw32\3.2.4\specs
> 
> and change "-lmsvcrt" to "-lmsvcr71".
> 
> Now MinGW will link with the same CRT as Python 2.4.

However, MinGW's header files are still written for MSVCRT.dll. IIRC, isupper()
and friends use a jump table called _ctype in MSVCRT.dll which is missing in
MSVCR71.dll. Some extensions will compile okay, some won't.

The order in which distutils adds 'msvcr71' to the list of libraries seems to
make sure that the PYD picks up free, malloc, printf, and other important
functions from MSVCR71.dll first before trying MSVCRT.dll. However, C++ modules
that use std::cout, for example, will crash.

AFAICT, there is currently no general solution for compiling Python 2.4
extension modules with MinGW. There probably won't be one unless MinGW is
patched to fully use MSVCR71.dll.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list