Sane API design (AKA C's #ifdef hell)

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Apr 17 14:37:28 UTC 2026


On 18/04/2026 2:31 AM, Dennis wrote:
>     They were just to make sure people are aware of the pain we who
>     write bindings to C libraries need to suffer in order to do it right...
> 
> I agree, that's why I'm a fan of exploring solutions to that. I already 
> mentioned ImportC, Rikki mentioned meta-data based generation (https:// 
> github.com/rikkimax/ogl_gen <https://github.com/rikkimax/ogl_gen>) which 
> I have used as well. I've also been using my own tool (https:// 
> dkorpel.github.io/ctod/ <https://dkorpel.github.io/ctod/>) for binding 
> generation, and recently I've been trying out LLMs. They all have their 
> strengths and weaknesses.

Metadata generators can be quite good like with OpenGL, but there are 
others... such as COM which are absolutely horrid c++ mixed 
monstrosities. I'm still unsure if it was a good thing or not for Walter 
to never implement it. It was part of D's original design document to 
include support.



More information about the Digitalmars-d mailing list