Thread overview
[Issue 12575] extern(C) mangling ignored inside mixin template
Apr 21, 2014
Andrej Mitrovic
Mar 28, 2016
Atila Neves
Jun 06, 2016
det
Oct 26, 2017
Walter Bright
Jul 25, 2019
Dennis
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=12575

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Technically they are part of a "namespace", since you can disambiguate them:

-----
mixin template T1()
{
    extern(C) void fizzle() { }
}

mixin template T2()
{
    extern(C) void fizzle() { }
}

mixin T1!() t1;
mixin T2!() t2;

void main()
{
    t1.fizzle();
    t2.fizzle();
}
-----

So I guess that's why they're mangled. As a workaround you can use this:

-----
mixin template T()
{
    // or just pragma(mangle, "fizzle"), but this will at least error if
    // you change the function name
    pragma(mangle, __traits(identifier, fizzle))
    extern(C) void fizzle();
}

mixin T!();

void main()
{
    fizzle();
}
-----

--
March 28, 2016
https://issues.dlang.org/show_bug.cgi?id=12575

Atila Neves <atila.neves@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |atila.neves@gmail.com

--- Comment #2 from Atila Neves <atila.neves@gmail.com> ---
The problem with this workaround is that it fails for `extern(C++)` unless you
use `pragma(mangle, ` with the exact same mangling.

--
June 06, 2016
https://issues.dlang.org/show_bug.cgi?id=12575

det <2krnk@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |2krnk@gmx.net

--
October 26, 2017
https://issues.dlang.org/show_bug.cgi?id=12575

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |mangling
                 CC|                            |bugzilla@digitalmars.com

--
July 25, 2019
https://issues.dlang.org/show_bug.cgi?id=12575

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dkorpel@live.nl
         Resolution|---                         |DUPLICATE

--- Comment #3 from Dennis <dkorpel@live.nl> ---


*** This issue has been marked as a duplicate of issue 962 ***

--