boilerplate generation
    Carl Sturtivant 
    sturtivant at gmail.com
       
    Sun Dec 29 13:40:43 PST 2013
    
    
  
I want to be able to define a number of extern(C) functions that 
will define a C API in a DLL, varying only in their names, each 
as follows.
export extern(C) int f( uint argc, A* argv) { return Wrapper!f( 
argc, argv); }
Here Wrapper!f is a wrapper around a D function named f that does 
the work, called from C via the f defined here.
I'd like a piece of D machinery that provides a short clean way 
to embed one of these in a program, where the name f is specified 
once, and the code is invisible. I've had no success at solving 
this problem with templates or mixin templates. I can use CTFE so 
I can write
mixin( Export("f"));
to introduce the definition for f. Is this the best way to 
proceed? What are other options?
    
    
More information about the Digitalmars-d-learn
mailing list