The standard does not address implementation details. There are many, many things that depend on the implementation and which prevent collaboration programs: how classes are laid out, the vtable structure, etc. In general, compilers will change if they change any of them. This is intentional as it prevents code that will not work when linked.
It is possible for a particular platform to define C ++ ABI; all compilers that adhere to this will use compatible implementations and the usual name. This is a problem for platform providers, however; for some reason, very few vendors have defined C ++ ABI.
And the reason extern "C" is because almost all platforms define C ABI.
James Kanze Apr 12 2018-12-12T00: 00Z
source share