[Distutils] why not link modules against msvcrt.dll istead of versioned msvcr*.dll? (mingw32)

Chris Jerdonek chris.jerdonek at gmail.com
Mon Nov 12 18:07:18 CET 2012


On Nov 12, 2012, at 5:36 AM, Ralf Schmitt <ralf at systemexit.de> wrote:

> Václav Šmilauer <eu at doxos.eu> writes:
>
>> Hi everybody,
>>
>> I recently (inconclusively) discussed on the mingw-w64 mailing list
>> why are compiled modules linked to msvcrt90 (depending on python
>> build) rather than to msvcrt. A compiled module was crashing (the DLL
>> would not load with "invalid access to memory and such") with msvcr90,
>> while it works just fine with msvcrt.
>
> I've also had problems with that with mingw-w64. The programs using
> mingw-w64 compiled extensions did crash randomly.
>
> I've replaced get_msvcr() in distutils/cygwinccompiler.py to just return
> an empty list:
>
> def get_msvcr():
>     """Include the appropriate MSVC runtime library if Python was built
>     with MSVC 7.0 or later.
>     """
> +    return []
>
>>
>> My understanding (based on
>> http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx,
>> http://msdn.microsoft.com/en-us/library/ms235460.aspx and my
>> aforementioned experience)  is that loading two MSVC runtimes at the
>> same time is asking for trouble. Dependency Walker shows me that
>> python27.dll itself is linking against msvcrt.dll, but
>> distutils.cygwincompiler will link against msvcrt90 nevertheless. This
>> means both end up loaded.
>>
>> OTOH I suppose there is a good reason why msvc version detection
>> exists, but I am just ignorant of it and would like to ask here.
>
> My guess would be that it's needed for some older gcc version. It looks
> like none of the python developers care enough to fix issues with
> mingw-w64.

Has someone already tried filing an issue about this on the tracker
(bugs.python.org)?  Otherwise, I wouldn't jump to this conclusion.

--Chris


>
> --
> Cheers
> Ralf
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig


More information about the Distutils-SIG mailing list