Cxx11 ABI for a single function call?

457 views Asked by At

Is it possible to define a piece of your code to be compiled with Cxx11 but the rest is using the compatibility ABI of libstdc++6 ?

Example:

// Compatibility ABI
int myvar = 0;
std::string mystring = "hello";

// This method is from another library
// that has been compiled with Cxx11
call_routine_ext_library(mystring);

// Compatibility ABI
myvar += 2;

My whole system is compiled in compatibility mode except one external library compiled with Cxx11. Does there exist a preprocessor that allows you to handpick certain part of your code to be compiled using the new ABI just as you would have defined D_GLIBCXX_USE_CXX11_ABI=1 on the compiler line ?

The error I get when calling the method call_routine_ext_library is:

undefined reference to `call_routine_ext_library(std::string const&)'

because the library contains this:

call_routine_ext_library(std::__cxx11::basic_string<char, std::char_traits<char>)

So I was hoping I could force the compiler to use Cxx11 mode when compiling the string I pass into that method. Are there any means of linking against a binary compiled with Cxx11 when your code is compiled without it ?

0

There are 0 answers