interfacing Cpp - GCC Dual ABI abi_tag in name mangling

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 29 17:34:33 PDT 2017


On Saturday, 29 April 2017 at 19:16:14 UTC, kinke wrote:
> On Saturday, 29 April 2017 at 18:08:16 UTC, سليمان السهمي 
> (Soulaïman Sahmi) wrote:
>> GCC has this attribute called abi_tag that they put on any 
>> function that returns std::string or std::list
>
> The usual workaround is compiling the C++ source with 
> _GLIBCXX_USE_CXX11_ABI=0 for gcc >= 5.

Thats what they said, the GNU guys have a very elegant way of 
deceiving people, especially when it comes to backwards 
compatibility. they made the flag on by default, and they said 
you could just opt out if you want. The problem is, if you opt 
out, you can't link to any code out there. because the flag is on 
by default and people just don't bother turning it off.
In my case the function is in a cpp library that i don't own, and 
wouldn't bother recompiling every library i need to interface to.
If  I compile! my code with the flag off, I cannot call any 
function that takes std::string or std::list as an argument on 
those libraries that were compiled with the flag on. because they 
also add a namespace called __cxx11 to std::string and std::list 
arguments in the name mangling. and if I compile with the flag 
off the namespace disappears.


More information about the Digitalmars-d-learn mailing list