It has become a nuisance to be forced to compile our whole software project with _GLIBCXX_USE_CXX11_ABI
set to 0, just so that we can link to one closed-source library whose vendor insists on backward ABI compatibility without offering a version compiled with the C++11 ABI.
This forces us to recompile several other libraries that are readily available as system packages, just because the default mode of compilation of the whole system has switched to C++11 ABI as the default (specifically, rhel8 clones).
My question is thus, is it possible to mix the two ABIs in a single object file, by, for example, referring to the old string as std::string
and the new string as std::__cxx11::string
explicitly -- or through some aliases -- then copying the raw data from c++11-abi string into the old-abi string on the way into the problematic library, and then copying the raw string data from the old-abi string back into a c++11- abi string on the way back from the library?
To the best of my understanding of libstdc++
source code, the inline namespace __cxx11
is never declared if _GLIBCXX_USE_CXX11_ABI
is 0; and if it is 1, the old-abi std::string
and basic_string
etc. cannot be accessed in any way.
So far I've only been able to create a const char *
wrapper for the old-abi library and use that wrapper from the c++11-abi library. It works:
$ nm --demangle a.out | ack ~basic_string
U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
U std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
But I find it very ugly. Is this the only way or is there something better?
Aucun commentaire:
Enregistrer un commentaire