[Distutils] MSVC CRT woes

Moore, Paul Paul.Moore at atosorigin.com
Thu Feb 5 04:30:50 EST 2004


From: Mark Hammond
>> Just to understand this: will this mean that you have to have VC7
>> in order to build extensions for Python 2.4 and onwards ?

> Officially, I think it will.  Unofficially, it will remain like it does
> today - it *may* work (depending on if you try and use Python API functions
> that use FILE objects).  IIRC, there used to be a problem of you implemented
> objects, as the malloc/free pairs happened in different CRTLs, but I think
> that in recent versions the macro-magic means they do match)

I believe that mingw will build extensions which work with Python 2.3 and 2.4,
because mingw supports both MSVC runtimes. You still have to build the
extension using distutils from the appropriate Python version (ie, you need
2 Python versions installed).

> A Python API function "PyFile_OpenFile()" would also solve this issue, but
> obviously that wouldn't exist in 2.3 or earlier, so doesn't help this
> specific case.

According to Martin von Loewis, this is a lost cause - mixing runtimes is
never OK, even if you don't use "dangerous" functions (like ones which use
FILE*). However, in practical terms, I've never generated a problem (although
I haven't tried very hard).

>> I think it is worthwhile (and have always argued that way) to have one
>> distutils version which can create Python distributables for various
>> Python versions, including as many older versions as possible.

> I believe that is the intent.  There is one other small issue I had trying
> to do this for win32all, but I will address that later.

>> Does the move to VC7 mean that we'll break this strategy with
>> Python 2.4 distutils ?

> Yes, unless we do as outlined in my mail.

I may be misunderstanding what is being discussed here, but I believe that with
the move to VC7, you will need the following to build extensions compatible with
both Python 2.3 and 2.4:

1. Installed copies of both Python 2.3 and 2.4.
2. EITHER MSVC 6 and 7 (both versions) OR mingw

But I am probably missing something, as once you have the 2 versions of Python
installed, I don't see the value in using a single shared distutils, rather than
the one that comes with each Python.

teaching-my-grandmother-to-suck-eggs-ly y'rs
Paul.



More information about the Distutils-SIG mailing list