3 ms·
The ABI issues are exactly the reason why having C++ as OS API level language is a bad idea.
by dfox 7y ago
The ABI issues are exactly the reason why having C++ as OS API level language is a bad idea.
- pjmlp 7y agoNot all, Android, IBM i (C++ has been slowly replacing PL/S), mbed, Windows, and OS X (IO Kit, now Driver Kit), are doing pretty alright. There is no such thing as C ABI, it only happens to work on OS that are, surprise surprise, written in C.
- tialaramex 7y agoThere is a C ABI. The "x86-64 System V ABI" (the ABI for C on everything except Windows on an x86-64, ie a typical PC) was designed by AMD working with early adopters on Linux and other platforms. Here are several extant ABI documents: https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI The ABI for C needs to agree less stuff than a C++ ABI but it's still quite a lot of stuff, if these things don't get agreed then code won't work unless everybody uses the same (version of the) compiler.
- pjmlp 7y agoAs the name already implies, that is an UNIX ABI, the OS where C was born, and naturally the OS ABI. x86-64 platforms not using the said ABI: - macOS, "This article describes differences in the OS X x86-64 user-space code model from the code model described in System V Application Binary Interface", (https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/MachOTopics/1-Articles/x86_64_code.html https://developer.apple.com/library/archive/documentation/De...) - Unisys Clear Path OS200 and MCP - Android (where JNI is what matters) - Chrome OS (where JavaScript and WASM is what matters) So no, it isn't everything except Windows on x86-64 and then there are all the other OSes running on ARM, MIPS, PowerPC, SPARC, PIC and plenty of other less relevant CPUs .