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

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed May 8 03:28:26 PDT 2013


On 5/8/13, Dicebot <m.strashun at gmail.com> wrote:
> Well, that is one of rather inconvenient issues with D handling
> of emitting symbols (this one kind of inherited from C++).
> extern(X) defines both mangling and calling convention. You can't
> have those separately now.

Yeah.

I suppose the ideal situation would be to have extern(C) follow strict
C mangling and calling convention (meaning no mangling for nested
extern(C) symbols), and have a separate linkage(C) feature to be used
when we want to set the linkage of a symbol (well, it's probably only
useful for functions) but let the compiler mangle it any way it wants
to (to avoid any symbol clashes).

There's a pull request somewhere which enables setting custom mangle
names for symbols, so we'll at least have the flexibility in picking
symbol names that we need.


More information about the Digitalmars-d mailing list