Example of using C API from D?

Arun Chandrasekaran aruncxy at gmail.com
Sun Sep 2 15:40:10 UTC 2018


On Sunday, 2 September 2018 at 12:52:11 UTC, Russel Winder wrote:
> I am rewriting a C++ program in D, but need to access a C 
> library that has no D binding: this is a GtkD based program 
> which has a Pango binding, but Pango doesn't offer the 
> information I need, that is hidden in the underlying Fontconfig 
> C API.
>
> I could create a complete D binding for Fontconfig using the 
> GIR files but that seems a bit over the top.
>
> Can anyone point me at an example of a D program using a C API 
> that has structs, enums and functions so I can see if I just 
> hack enough for my use or go on to the full binding activity.

You can look at zmqd[1] as an example. I've been using it in 
production. I've also used dstep[2] to translate C headers to D.

[1] https://github.com/kyllingstad/zmqd
[2] https://github.com/jacob-carlborg/dstep


More information about the Digitalmars-d-learn mailing list