Why extern variables and functions within template/struct/class have a D mangling

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed May 8 02:09:18 PDT 2013


On 5/7/13, Igor Stepanov <wazar.leollone at yahoo.com> wrote:
> struct Foo
> {
>    extern(C) void bar()
>    {
>
>    }
> }
>
> Is it good to set bar mangling to "bar"?

No. For one example, internal extern(C) functions can be used for
callbacks. You wouldn't want linking to fail if you have this code:

struct A
{
    extern(C) void callback() { }
}

struct B
{
    extern(C) void callback() { }
}


More information about the Digitalmars-d mailing list