4 ms·
There are a ton of shared C++ libraries in Linux distros that maintain ABI stability without wrapping with a C ABI.
by leni536 4y ago
There are a ton of shared C++ libraries in Linux distros that maintain ABI stability without wrapping with a C ABI.
- matheusmoreira 4y agoABI stability between C++ libraries and applications built with the same compiler, sure. In other words, the only code that touches C++ code is other C++ code.
- leni536 4y agoNot necessarily same compiler. You can use clang and safely link to C++ libraries shipped by the disto, which are compiled by gcc typically.
- kibwen 4y agoThe Clang and GCC ABIs aren't quite 100% compatible there, e.g. you can't pass __int128 between libraries compiled by different compilers.
- leni536 4y agoOK, I did not know that. I assume it equally affects C and C++ though.
- matheusmoreira 4y agoSource for the __int128 incompatibility claim, posted on another thread: https://news.ycombinator.com/item?id=34147105 https://news.ycombinator.com/item?id=34147105 https://faultlore.com/blah/c-isnt-a-language/ https://faultlore.com/blah/c-isnt-a-language/ I'd like to emphasize that these tests were simple function calls between C code generated by C compilers. I can only imagine the hell that might be unleashed if similar tests for C++ ABIs are created.
- leni536 4y ago> clang and gcc can’t even agree on the ABI of __int128 on x64 linux. That type is a gcc extension but it’s also explicitly defined and specified by the AMD64 SysV ABI in one of those nice human-readable PDFs! Yikes! So it is supposedly defined in the SysV ABI, and at least one of the compilers fails to implement that. Are there bug reports for this? How does the disagrement manifest? Different calling concention when used as a function parameter or return value? Different alignment? I doubt that it would have different size or object representation.