I tend to use static builds and LTO which don't have a stable ABI to begin with. They allow for more optimization and overall smaller binaries.
When building with MSVC, using
-MT
is ABI-incompatible with
-MD
when passing STL types across the shared library boundary. So you just learn how to rebuild everything with the correct runtime, then you can do that with LLVM on Windows, on Linux and OSX too with
LD_LIBRARY_PATH
and
install_name_tool
, respectively.
MSVC is a particular pain in the ass in terms of breaking the ABI, sometimes defaulting to compatible behavior rather than standards conformance:
Code:
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
add_definitions(-D_ENABLE_ATOMIC_ALIGNMENT_FIX)
Code:
// not supported with MSVC v14x ABI, see https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/
#define myproject_no_unique_address msvc::no_unique_address
I'd rather ship my own
libc++
with the program binary than make any sacrifices to performance or correctness.