3 ms·
You can explicitly export functions you want available outside, disabling the name mangling (using export "C"). I'm not sure how else you think C++ could handl
by Erwin 14y ago
You can explicitly export functions you want available outside, disabling the name mangling (using export "C").
I'm not sure how else you think C++ could handle its goals without the name mangling: overloading and compatibility with C's linker system. If you have two overloaded "foo" functions you need to somehow designated them as separate linker symbols.
C has similar problems of its own: like what's the calling convention for the exported symbol? Do I push the arguments on the stack, and who cleans up? Do some arguments go into registered? Where does the return value go? What's the layout of a struct? All things are platform, compiler and compiler configuration dependent.
What other languages, that compile to object files or shared objects, that support the level of OO features etc. that C++ has, have a well-defined ABI?