Why extern variables and functions within template/struct/class have a D mangling
Igor Stepanov
wazar.leollone at yahoo.com
Thu May 9 08:43:03 PDT 2013
On Wednesday, 8 May 2013 at 19:14:14 UTC, Andrej Mitrovic wrote:
> On 5/8/13, Dicebot <m.strashun at gmail.com> wrote:
>> Well, pardon me, I probably have exceeded my allowed daily rant
>> limit :)
>
> Don't worry, and I agree with you. But I think it's probably
> too late
> to actually change what a linkage specifier does for nested
> symbols.
> We might end up getting duplicate symbol definition errors
> (hello
> Optlink..) in completely unrelated libraries if mangling
> changes for
> these symbols.
I've undestood, that function mangling is a difficult issue.
But what about extern variables?
Obviously, when user write ("extern(C) extern int var;"), he want
to get extern variable with C mangling. Another way: get second
parameter (symbol name) to extern attribute.
E.g.
extern(C, "@FOO@")void FOO(int); //have C linkage and @FOO@
mangling
extern(C)void FOO2(int); //have C linkage and C (or D, if FOO2 is
local symbol) mangling
extern("__FOO__") void FOO(int); //have D or System linkage and
"__FOO__" mangling
However, I would like to mangling argument of extern attribute
will be evaluatable form any string expression.
enum MANGLING = "@@@M@@@";
extern(D, MANGLING) int boo();
More information about the Digitalmars-d
mailing list