C++/C mangleof inconsistency for OS X

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 23 11:07:37 PDT 2015


On 23 April 2015 at 19:15, Dan Olson via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> Iain Buclaw via Digitalmars-d <digitalmars-d at puremagic.com> writes:
>>
>> (FYI - last time I checked GDC goes ahead and applied target-specific
>> mangling on-top of pragma(mangle).  So you can relax and assume
>> nothing about the target).
>
> So does LDC.
>
> Actually, DMD does too on OS X, but only for extern(C) - attention to
> func plughc.
>
> pragma(mangle, "plughc")   extern (C) void plughc();
> pragma(mangle, "plughd")   extern(D) void plughd();
> pragma(mangle, "plughcxx") extern(C++) void plughcxx();
>
> pragma(msg, plughc.mangleof);
> pragma(msg, plughd.mangleof);
> pragma(msg, plughcxx.mangleof);
>
> $ dmd -c showmangle.d
> plughc
> plughd
> plughcxx
>
> $ nm showmangle.o | grep plugh
>                  U _plughc
>                  U plughcxx
>                  U plughd
>
> Maybe this all needs to be left in implementation defined land?

There should *always* be a prefix there. ;-)

A 'nice to know' which is specific to GDC.  If you prefix
pragma(mangle) names with "*" then it will not apply target-dependent
prefixes.

Regards
Iain


More information about the Digitalmars-d mailing list