Thread overview
[Issue 8207] OS X: Should extern(D) symbols include another underscore?
Apr 21, 2015
Dan Olson
Sep 28, 2017
David Nadlinger
April 21, 2015
https://issues.dlang.org/show_bug.cgi?id=8207

Dan Olson <gorox@comcast.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gorox@comcast.net

--- Comment #2 from Dan Olson <gorox@comcast.net> ---
I would think yes, D symbols emitted to the object file on OS X should have extra underscore.  And .mangleof should produce the symbol without the extra underscore as it does today.

extern(C++) has opposite problem.  The extra underscore is present in object file (correct) but is also present in .mangleof symbol.  It should be stripped from the .mangleof symbol.  Note: ldc merge-2.067 does this now which caused test compilable/test7030.d to fail, which is how I got here.  I think LDC is correct.

-- demo --
void dfun(int);
extern(C++) void cxxfun(int);
extern (C) void cfun(int);

pragma(msg, dfun.mangleof);
pragma(msg, cxxfun.mangleof);
pragma(msg, cfun.mangleof);

dmd 2.067 produces:
_D10showmangle4dfunFiZv
__Z6cxxfuni
cfun

where obj file has these symbols:
                 U _D10showmangle4dfunFiZv
                 U __Z6cxxfuni
                 U _cfun

--
September 28, 2017
https://issues.dlang.org/show_bug.cgi?id=8207

David Nadlinger <code@klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2@gmail.com

--- Comment #3 from David Nadlinger <code@klickverbot.at> ---
*** Issue 15748 has been marked as a duplicate of this issue. ***

--
February 10, 2018
https://issues.dlang.org/show_bug.cgi?id=8207

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/db2976599db44f2163986ba9cb541afd7cfa8471 fix Issue 8207 - extern(D) symbols should include another underscore

    1. Removed ABI name fiddling from the front-end.
    2. Removed `Target.prefixName` and C++ tests for matching `__Z`.
    3. Prepend prefixes for C++ and D symbols in the backend only
       for the targets that require it (Win32, OSX).
    4. Removed `RTLSYM__DINVARIANT` runtime library symbol, name is now
       the same on all targets.
    5. Correctly set C++ mangling on `LINK.cpp` symbols, before they
       were all being set as D mangled symbols.
    6. Use System mangling as synonym for do not modify symbol.
    7. Added workaround for `extern(D) ___tls_get_addr`.

https://github.com/dlang/dmd/commit/9691eba9441f7f165359716f80f46486ea09fb46 Merge pull request #7620 from ibuclaw/ingcc2

fix Issue 8207 - extern(D) symbols should include another underscore
merged-on-behalf-of: unknown

--
February 10, 2018
https://issues.dlang.org/show_bug.cgi?id=8207

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--