C++/C mangleof inconsistency for OS X
Guillaume Chatelet via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 22 04:25:13 PDT 2015
On Wednesday, 22 April 2015 at 01:46:57 UTC, Daniel Murphy wrote:
> Until fairly recently .mangleof was completely broken for eg
> extern(C++) mangling on windows. I'm not surprised there are
> still bugs there. Ideally .mangleof will give exactly the
> string that ends up in the object file.
This is still broken
https://issues.dlang.org/show_bug.cgi?id=14178
I'm actually recoding the name mangling for linux/osx right now
because the current implementation cannot work correctly with
compression/substitutions (see
http://mentorembedded.github.io/cxx-abi/abi.html#mangling-compression)
This is really tricky since substitution doesn't work the same
when mangling template parameters or arguments. I'm making
progress but there's a lot of gotchas. Especially if you start
mixing namespace nesting, template instantiation and STL mangling
substitutions.
You can have a look at the incomplete tests I have :
https://raw.githubusercontent.com/gchatelet/dmd/new_cpp_mangle/test/compilable/cppmangle.d
For instance this one is already pretty hard to understand :
_ZNK6nested21NestedTemplatedStructIiE23templatedMemberFunctionINS_12NestedStructEEEPT_PPKS4_
You can check the result with http://demangler.com/
Getting this right is a prerequisite to C++/STL integration.
More information about the Digitalmars-d
mailing list