3 ms·
Not wrap per se, but bind. The parts of the .h file you need needs to be translated to D. There's no runtime cost to this and the function works the same as in
by destructionator 5y ago
Not wrap per se, but bind. The parts of the .h file you need needs to be translated to D. There's no runtime cost to this and the function works the same as in C which is why I don't like calling it a wrapper.
But doing this is easy, sometimes literal copy/paste, often copy/paste with simple adjustments. There's various automated options that can do 95% of the work too.
- hnedeotes 5y agoAh, so basically you just have to create somehow a header file that D can use? I've looked into the `deimos` repos and there's a bunch of them, what I see is, C header files in a folder, then a folder with one or several d files (not .di), that set up somethings and have a extern (C) { ... } block declaring types and funcs from the C header file. Then when building you just link the original required C libs? It seems nice.