How to link to a function with [abi:cxx11] defined in a shared library?

  abi, c++, linker-errors, shared-libraries, string

I am peeking into a shared library using the nm tool. I have two versions of this library, and on each version, I have a definition for an overloaded typecast, namely

Version 1

[email protected]:~frameworkPath1/lib
$ nm -D libcomm.so | c++filt | grep comm::InstanceID::operator

000cda80 T comm::InstanceID::operator std::__cxx11::basic_string<char,
std::char_traits, std::allocator () const

Version 2

[email protected]:~frameworkPath2/lib
$ nm -D libcomm.so | c++filt | grep comm::InstanceID::operator

00080ead T comm::InstanceID::operator std::__cxx11::basic_string<char,
std::char_traits, std::allocator >[abi:cxx11]() const

what is this this >[abi:cxx11], and how should my function signature/declaration should look like in my header file, so that it matches version 2? do I need a special compiler flag, or link a special library?

As a reference, the function which links succesfully with version 1 looks like this:

namespace comm {

  struct InstanceID{
     .
     .
    __attribute__ ((visibility("default"))) operator ipl::string () const;
  }
}

Source: Windows Questions C++

LEAVE A COMMENT