DMD: can't get extern __gshared to work right (vs. LDC)
rikki cattermole
rikki at cattermole.co.nz
Mon Feb 18 17:51:09 UTC 2019
On 19/02/2019 6:26 AM, DanielG wrote:
> In the meantime, while I'm waiting for this bug to be noticed by anybody
> with the skills to address it, what would be the most elegant way of
> working around it?
>
> Obviously I could do a:
>
> version(Windows) {
> export extern __gshared ...
> } else {
> extern __gshared ...
> }
>
> But what's the minimal way of toggling the presence of "export" in a
> declaration? Using mixins feels kind of gross for this, but if that's
> the only option ...
>
> Almost makes me long for the C preprocessor :P
Because you need two different versions to choose between them, either
set a per module version or use static if with enum's.
But yeah, I would do that. Of course a mixin template with a code string
(q{ ... }) would be cleaner. After all, ``export { mixin(str); }`` would
work well.
More information about the Digitalmars-d-learn
mailing list