C to D bindings: how much do you D-ify the code?

Dicebot public at dicebot.lv
Fri Oct 25 06:34:26 PDT 2013


I think best approach is to have 2-step bindings. First step is 
pure 1-to-1 translation with no D-ification at all. Second step 
is D wrapper that expresses same functionality in more native 
syntax (probably even more type-safe). Step-2 module imports 
Step-1 module of course.

Benefit of such approach is that you can generate bindings using 
automatic tool when new header version is out without wasting 
time on adjusting those to D style again and again - you only 
need to change step-2 module if there are some breaking API 
changes.


More information about the Digitalmars-d mailing list