[Issue 20012] export inside mixin doesn't seem to work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 24 02:53:01 UTC 2019


--- Comment #9 from Manu <turkeyman at gmail.com> ---
A template mixin with an extern(C) function in it is obviously meant to be
included at the global scope, why on earth would there be an extern(C) function
in a template mixin otherwise? Especially an `extern` one.
Nobody would be surprised by a link error complaining about multiple
definitions of an extern(C) function; in fact, they'd be annoyed if it didn't.

The pattern of a reflection template mixin placed at top-level is unbelievably
common, and this code is common-sense for anyone trying to emit
reflection-based data from a DLL.
Lots of people don't use DLL's, so maybe it hasn't come up, but I use DLL's a

Seriously, the only conceivable useful thing you could do with an extern(C)
function in a template mixin doesn't work. This is a bug.

extern(C) means extern(C). There's no reason to re-interpret what extern(C)
means in this one weird case. extern(C) specifies mangling and ABI, not
mangling, or ABI, or maybe both.


More information about the Digitalmars-d-bugs mailing list