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

Jacob Carlborg doob at me.com
Sat Oct 26 03:54:03 PDT 2013


On 2013-10-25 15:10, Lionello Lunesu wrote:
> There's a lot of expressiveness that can be added to D bindings, when
> compared to the C or C++ headers, for a particular library:

I agree with what others have said. I can add that I sometimes use three 
layers.

1. The actual C bindings. Stay as close as possible to the original code
2. Slightly D-ify the C bindings. I.e. be able to pass D strings instead 
of C strings
3. Create wrappers. Either object oriented with classes or something in 
between, like structs with some internal sate and a couple of methods

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list