RE: my program compiled by GCC crashed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

> The C++ libraries aren't like the C ones, compatible with each C/C++ compiler but specific to only one :(

Correct.  Alas.

Most platforms have a well-defined platform standard C ABI, which all C compiles for that platform ought to comply with.  C compilers which do not comply with the platform's C ABI do so at their own risk.

There is no well-defined platform standard C++ ABI.

The ABI specifies things like how the parameters are passed, how the return parameter is returned, how the function names get mangled, alignment, the layout of structs (including alignment and padding).

For C++, there are additional things like how the virtual function table is laid out, how exception handling is handled (including stack unwinding and destructors along the way), RTTI mechanism (including layout) which is used by dynamic casts and typeinfo and exception catch handling, the STL and other template classes and their layout and mangling and linkage, and zillions of other details that are critically important for different libraries (static, SSO, or DSO) and plugins (usually DSO) to interface.

As such, it is extremely unlikely that C++ compilers can interface at the C++ level unless those C++ compiler vendors have taken meticulous effort to be interoperable.

And even then, when new compiler versions come out, sometimes that compiler from the self-same vendor is not backwards compatible with its previous version.

There are efforts to improve the C++ ABI situation, such as <http://www.codesourcery.com/public/cxx-abi/>.  Last I checked, they are in the draft / early proposal stages, and may be particular to a specific platform.

For Microsoft COM on Microsoft Windows, there is some interplay / co-dependence on C++ layout and COM layout.  But that isn't enough to cover the gamut of what a C++ ABI entails.

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux