[Issue 12892] extern(C): label confined to version scope

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 11 18:03:55 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12892

yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies at gmail.com

--- Comment #9 from yebblies <yebblies at gmail.com> ---
(In reply to Walter Bright from comment #3)
> 
> 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 ~ "}" );

If you really need this behavior it can be done TRIVIALLY with

extern(System):

...

--


More information about the Digitalmars-d-bugs mailing list