Groups | Blog | Home
all groups > visual c > july 2006 >

visual c : Portable C++


Andrew Roberts
7/30/2006 4:13:04 PM
Could anyone recommend to me any good books or online articles that contain
in depth coverage of portable C++ development? Specifically writing binary
compatible C++ interfaces and code that will work and be fully compatible
where code built under multiple versions of the compiler/runtime are being
used in the same process. Exceptions are being thrown over module
boundaries.

Currently the system is deployed on Windows and components built with VC8, 7
and 6 are all used within the same process, due to efforts by Microsoft to
make their compilers/runtimes compatible this just works, will this continue
to be the case if the system is built for say Linux and several versions of
the compiler are mixed?

Bruno van Dooren [MVP VC++]
7/30/2006 6:30:10 PM
[quoted text, click to view]

I am sorry, but what you want to do is virtually impossible.
different compilers are almost always incompatible.

[quoted text, click to view]

Microsoft is indeed a company that values binary compatibility.
If you would try to do this on linux, you would -in all likelihood- fail.
gcc is notorious for incompatibility across versions. In part this is
because the whole point of the open source is to advocate source
distribution.
providing binary compatibility would be like shooting yourself in the foot.
(I am all for binary standards, but that is just me.)

mixing different compilers (like gcc and msvc) for C++ is not going to work
either.

The only exception is if you create COM components. for COM to work, class
vtables have to have a specific layout.
Since every compiler supports COM, that is where your only option lies.

--

Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"

AddThis Social Bookmark Button