Extensions to types loaded from a C library
    Jeremy DeHaan 
    dehaan.jeremiah at gmail.com
       
    Fri Dec 14 10:45:35 PST 2012
    
    
  
>
> With D's UFCS syntax, there's really no need to modify Derelict 
> directly to extend a C struct.
>
> http://www.gamedev.net/blog/1140/entry-2254754-uniform-function-call-syntax-in-d/
>
> Obviously, this technique won't work for constructors, but it 
> should work for most any other method you'd like to add. And I 
> don't see a need to add a constructor anyway except in very 
> specific circumstances (i.e. you want a constructor with fewer 
> or more params, or different types, than the number or type of 
> struct fields). And even then it's only a convenience.
Wow, that is awesome! I think I can definitely make use of that!
By the way, I thought I should mention that I wasn't suggesting 
Derelict needed to be modified. It was just what I had to 
experiment with. ;)
And thanks to everyone else that gave me answers!
    
    
More information about the Digitalmars-d-learn
mailing list