[Python-Dev] MinGW And The other Py2.4 issue

Paul Moore p.f.moore at gmail.com
Mon Dec 13 10:58:49 CET 2004

On Sun, 12 Dec 2004 23:19:55 +0000, A.B., Khalid <abkhd at hotmail.com> wrote:
>      [2] Can someone who has the official Python 2.4 download the sample
> extension [**] created using the pyMinGW patched & MinGW compiled Python 2.4
> and SWIG? And see if it works?
> Sources are in the zip file whose details appears bellow.

I tried this out, and from some basic uses, it seems to work OK.
However, the PYD file references msvcrt.dll, which suggests that there
will be issues in more complex cases. The biggest problem with CRT
compatibility issues is that (AFAIK) no-one has actually been able to
trigger a *real* error, all of the problems are still theoretical. I
have done some fairly extensive analysis of what could go wrong, and I
suspect that there are very few genuine cases where data from one CRT
could end up being manipulated by another - but this doesn't mean that
the problems aren't real, just VERY hard to locate :-(

My current technique for checking an extension is compatible with
Python 2.4 is to run objdump -p (from the mingw distribution - use
dumpbin /imports from MSVC) and review the import table. If any
symbols are referenced from msvcrt.dll, you need to convince yourself
that they are used solely by the mingw runtime startup code. For added
certainty, add a dummy function to your C code which references these
symbols, rebuild and confirm that they are now satisfied from msvcr71.
(For total guarantees, you need to get Martin to validate your
analysis, as he seems to be the only person here who *really*
understands the potential issues :-))

If you want to build extensions compatible with the standard Python
2.4 build, you need to add the -lmsvcr71 flag to the build (link

Hope this helps,

More information about the Python-Dev mailing list