I've seen a lot of discussion about how C++ doesn't have a Standard ABI quite in the same way that C does. I'm curious as to what, exactly, the issues are. So far, I've come up with
Are there any other ABI issues pertaining to C++?
C does not have a standard ABI.
For the standard library the primary issues causing potential ABI breakage are those which change the layout of a class or a class template or the changing the behavior of typically inlined functions.
As C++ evolved over the years, the Application Binary Interface (ABI) used by a compiler often needed changes to support new or evolving language features. Consequently, programmers were expected to recompile all their binaries with every new compiler release.
An ABI can define a standard way of encoding the name of a function so that programs built with a different language or compiler can locate what they need. When you use extern "c" in a C++ program, you're instructing the compiler to use a standardized way of recording names that's understandable by other software.
Off the top of my head:
C++ Specific:
Generic.
The big problem, in my experience, is the C++ standard library. Even if you had an ABI that dictates how a class should be laid out, different compilers provide different implementations of standard objects like std::string
and std::vector
.
I'm not saying that it would not be possible to standardize the internal layout of C++ library objects, only that it has not been done before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With