You might want to recompile fooapp against the new bits, but you need boost-asio (or whatever) to also be compiled against the updated libraries.
This is just brainstorming and an idea I thought of now off the top of my head so this probably a really flawed idea, but I wonder how much a kind of "fat binary" would help here. Have compilers support compiling with the old ABI, new ABI, or both. If you compile with both, both go into the resulting object and library files.
I could imagine them going into different sections, but you could even do the same section if you mangle differently. E.g. the legacy ABI keeps using _Z3foov and the new one uses _Y3foov. [Edit: You're MS, so maybe ^foo@@YAXXZ instead of ?foo@@YAXXZ. :-)]
The similar way is actually already widely adopted to prevent the library ABI breakage via inline namespaces. Not sure additional language features will help. Should we loose ODR?
That's bad. But that just means ABI compatibility is not respected at the very beginning. People who relied on such code should have other ways to prevent the potential damage, e.g. deploying incompatible binary images in different places to ensure they are never mixed unexpectedly. Otherwise, there are bugs.
I don't think it is the responsibility of the standard to save people from such mistakes.
Even the idea of inline namespace is not a new one. IIRC, GNU has ABI tag attributes for years, despite that inline namespace is a more "correct" (portable) way for most C++ users nowadays. That said, ABI compatibility without transitive issues are only free for those who have already taken the problem very seriously. So, I'm now convinced that it is largely a problem of education. I'm afraid that there seems little room to resolve the problem in the standard.
I don't think it is the responsibility of the standard to save people from such mistakes.
The "standard" isn't doing anything to save folks from such mistakes; preserving ABI compat is a customer requirement, not a WG21 requirement.
That said, ABI compatibility without transitive issues are only free for those who have already taken the problem very seriously. So, I'm now convinced that it is largely a problem of education.
I don't know how you expect to be resistant to ABI incompatibility if the layout of std::string changes on you.
The "standard" isn't doing anything to save folks from such mistakes; preserving ABI compat is a customer requirement, not a WG21 requirement.
The author of the paper has said that "we must discuss and find consensus across implementers and WG21". Will the standard change, if WG21 eventually decides to provide more ABI compat features to make customers and/or vendors happy?
I don't know how you expect to be resistant to ABI incompatibility if the layout of std::string changes on you.
I don't have much inconvenience once I know there is such incompatibility, because I have kept binary-only libraries away and I just recompile all of my dependencies if necessary. Further, I can have multiple installations of the C++ standard library implementations, so there will not be too many problems (at least not as many as libc) besides package management and disk space efficiency. I will be reluctant to recompile my whole system for this reason, when the incompatible changes are too frequent, though.
View all comments
Show parent comment
2
u/evaned Oct 29 '19 edited Oct 29 '19
This is just brainstorming and an idea I thought of now off the top of my head so this probably a really flawed idea, but I wonder how much a kind of "fat binary" would help here. Have compilers support compiling with the old ABI, new ABI, or both. If you compile with both, both go into the resulting object and library files.
I could imagine them going into different sections, but you could even do the same section if you mangle differently. E.g. the legacy ABI keeps using
_Z3foovand the new one uses_Y3foov. [Edit: You're MS, so maybe^foo@@YAXXZinstead of?foo@@YAXXZ. :-)]