https://issues.dlang.org/show_bug.cgi?id=12892
Walter Bright <bugzi...@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86_64 |All OS|Windows |All Severity|normal |enhancement --- Comment #3 from Walter Bright <bugzi...@digitalmars.com> --- A few comments: 1. This is working as designed, so I've marked this as an enhancement request rather than a bug. 2. It applies to all platforms and memory models, so reclassified accordingly. 3. Changing the behavior will break an unknown amount of existing code. 4. Changing the behavior in the compiler will not be simple, as it will no longer be a parsing/grammar issue but a semantic one. 5. extern(Windows) on non-Windows platforms should produce C linkage behavior anyway, so this particular usage does not seem to be necessary. I also have to question why one would need extern(Windows) for any reason other than interacting with Windows API functions, which don't exist on other platforms. 6. If you really need this behavior, it can easily (but not prettily) be done using string mixins: enum string mydeclarations = q{ int a; void foo(); }; version(Win32) { enum string linkage = "Windows"; } else { enum string linkage = "C"; } mixin( "extern(" ~ linkage ~ ") {" ~ mydeclarations ~ "}" ); --