How to make py2.5 distutil to use VC2005?

甜瓜 littlesweetmelon at gmail.com
Thu Jun 5 11:01:10 CEST 2008


> The problem is not compiler, but runtime. For example, if python is
> built with runtime foo, and yours with runtime bar, and you use in bar
> a file handle, you're screwed:
>
> http://msdn.microsoft.com/en-us/library/ms235460(VS.80).aspx
>
> That's why you cannot build a python extension with VS 2005 for python
> 2003, in a reliable way.

Thank you for providing this document. Indeed, passing internal
pointers of one CRT lib to another is dangerous. But in most cases,
the python extension only focus on computational-intensive jobs
rather than API-intensive jobs. Therefore it is safe to let VS2003-built
python to call VS2005-built extensions with some attentions.

When you use distutil to trigger compilation, a special *python script*
will check whether the default compiler is VS2003. If there is no
VS2003, this script will pop-up the error for incompatible compilers.
I really really wonder how to *force* distutil to use my specified compile.
eg: (pseudo)
python setup.py build -c VC2005
or
python setup.py build --compiler=C:\VC8\cc --linker=C:\VC8\ld

   Regards,

---
ShenLei



More information about the Python-list mailing list