[Python-Dev] [Distutils] Adventures with x64, VS7 and VS8 on Windows

Nick Coghlan ncoghlan at gmail.com
Tue May 29 15:27:36 CEST 2007


Martin v. Löwis wrote:
>> I have a set of extensions that use SWIG to wrap my own C++ library. 
>> This library, on a day-to-day basis is built against VS8 since the rest
>> of our product suite is.  Right now I have no way to work with this code
>> using VS8 since the standard distribution is built against VS7 which
>> uses a different CRT.   This is an absolute nightmare in practice since
>> I currently have to maintain VS7 projects in parallel with the standard
>> VS8 ones simply so that I can run and test my python code.
> 
> If you know well enough what you are doing, and avoid using unsupported
> cases, you *can* mix different CRTs.

I can attest to this - I have SWIG-wrapped extensions built with VC6 
running quite happily against the official VS7 binaries for Python 2.4. 
Moving from Python 2.2 to Python 2.4 was a simple matter of recompiling 
and relinking the modules.

The important thing was to make sure to never pass memory ownership or 
standard lib data structures across the boundary. I haven't actually 
found this to be all that difficult in practice, as I am typically 
either copying data from standard library data structures into native 
Python data structures (e.g. between std::string and PyString) or else 
merely accessing the Python wrappers around my own C++ classes. In both 
cases memory ownership remains entirely within the extension module, and 
all interaction occurs through the Python C API, and never indirectly 
through the CRT.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list