September 19, 2011
On 09/18/2011 11:04 PM, Daniel Murphy wrote:
> "Ellery Newcomer" <ellery-newcomer@utulsa.edu> wrote in message news:j557r6$vgt$1@digitalmars.com...
>> Just came across some old D code that does this:
>>
>> version(linux){
>> extern(C):
>> }
>>
> 
> Are the prototypes extern(Windows) when not on linux, by any chance?  That is the only combination I've ever had to use, and is supported by extern(System).
> 
> 

yep. didn't know about System. Thanks.
September 19, 2011
On 09/19/2011 08:59 AM, Timon Gehr wrote:
> 
> You could use the C preprocessor ;). Or this, that does the same thing:
> 
> version(V1) private enum _v1=true;
> else private enum _v1=false;
> mixin((_v1?"extern(System):":"extern(C):")~q{
>     // all declarations that should be affected.
> });

<code golf>

or this:

version(linux){
 extern(C):
  mixin(s);
}
version(Win32){
 extern(Windows):
 mixin(s);
}

enum s = q{
 <hundreds of opengl decls>
};

</code golf>
1 2
Next ›   Last »