[Python-Dev] MS VC 7 offer

David Abrahams dave@boost-consulting.com
Tue, 06 May 2003 18:01:28 -0400


"Martin v. L=F6wis" <martin@v.loewis.de> writes:

> Alex Martelli wrote:
>
>> When we discussed VC versions (back when we met in Ofxord during
>> PythonUK/ACCU), David Abrahams seemed adamant that VC7 and VC6
>> are indeed compatible
>
> I doubt he said this in this generality

Actually, I did.  I may have overstated the case slightly, but not by
much.

> he surely knows that you cannot mix C++ objects files on the object
> file level between those compilers, as they implement completely
> different ABIs.

They implement substantially similar ABIs.  Here are the facts in
full, glorious/gory detail from a member of Microsoft's compiler team.
I quote:

    The bottom line: the ABI is backwards compatible.

    We do require using the linker that matches the newest compiler
    used in a set of .obj files.

    There were some incompatible name decoration changes (function
    templates) b/w VC7 and VC7.1.  Most people should never notice
    this one, though I know of at least 1 customer that did.

    Another name decoration change was made b/w VC6 and VC7, but
    nobody should notice that change, since they were hitting a broken
    construct anyway.

    There was a SP of VC6 that is incompatible with VC7 and other
    builds of VC6, I forget which exactly, maybe SP4, or maybe it was
    the processor pack.  It only involved pointer to members, but we
    were layout incompatible.

    The only other issues I can think of are related to
    __declspec(align(N)) and __unaligned (IA64 only, really.)

> For Python, the biggest problem is that you cannot pass FILE* from
> one C library to the other, because of some stupid locking test in
> the C library. This does cause crashes when you try to use Python
> extension modules compiled with the wrong compiler.

Assuming you are passing availability of FILE*s across the extension
module boundary and the extension module author is using the VC7
libraries instead of those that ship with VC6 (using the VC6 libraries
with VC7 would be a trick)... then yes.

In practice, making sure that resources are only used by the
appropriate 'C' library is not too difficult, but requires a level of
attention that I wouldn't want to demand of newbies.  I certainly
build all kinds of Boost.Python extension modules with VC7 and test
them without problems using a VC6 build of Python.

HTH,
--=20
Dave Abrahams
Boost Consulting
www.boost-consulting.com