C++ ABI: What It Really Is and Why It Breaks
Thoroughly Understanding C++ ABI

The article demystifies the C++ Application Binary Interface (ABI) by examining its core components: object file formats (PE32+ vs ELF), data representation, and calling conventions on x64 platforms. It explains how these elements affect binary compatibility and stability, using practical examples to illustrate issues like ODR violations and the performance implications of passing structs by value versus reference. The author also compares System V and Windows x64 ABIs, offering insights into why certain coding practices are more efficient on one platform than the other.
If the caller thinks parameters should be passed via registers, it stores the parameters in registers. But the callee thinks parameters should be passed via the stack, so it retrieves data from the stack. Inconsistency arises, and it’s very likely that garbage values are read from the stack, leading to logical errors in the code and program crashes.
- Dwedit
C++ ABIs are why Win32 settled on things like COM to do cross-module passing of objects. Because nobody could agree on a standard, the COM standard enforced a very specific calling convention, and a very specific vtable layout for COM objects.
- rramadass
As always, read wikipedia and follow links as needed - https://en.wikipedia.org/wiki/Application_binary_interface
- rramadass
GNU libstdc++ "Dual ABI" issue - https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_a...
- jeffbee
One nice thing to remember is for projects you control, you can dictate the ABI. There isn't a law enforcement bureau that will arrest you for passing parameters in whatever register suits you. You just have to imagine life differently than they did in the 70s when they dreamed up dynamic libraries for reasons that are largely no longer valid.
- jdw64
Does the C++ standard guarantee binary ABI? Isn't that something that compiler and library contributors handle separately? So I think the arguments you see online are more accurate—vendors are the ones maintaining it.
In other words, the ABI we rely on today isn't really part of the C+ standard—it's more like the Itnaium C++ ABI or the MSVC C++ ABI.
In the end, I think the ABI stays stable because of community conventions established by compiler vendors.