DStep rocks [was Example of using C API from D?]

Laeeth Isharc Laeeth at laeeth.com
Sun Sep 2 21:54:29 UTC 2018


On Sunday, 2 September 2018 at 17:49:45 UTC, Russel Winder wrote:
> On Sun, 2018-09-02 at 18:28 +0100, Russel Winder wrote:
>> 
> […]
>> It turns out that the GIR file is not usable, and so the 
>> girtod route is not feasible. I shall try the DStep route. 
>> Failing that it seems there is
>> 
>> https://github.com/WebFreak001/fontconfig-d
>> 
>> which is a manual transform of a snapshot of the C API, so not 
>> an
>> ideal
>> way, but a definite backstop position. It seems someone has 
>> trodden
>> the
>> "using Fontconfig in D" path before me.
>
> I compiled DStep master/HEAD (v0.2.3-16-g1308991) against LLVM 
> 6.0 and it seems to have done a rather splendid job of creating 
> a D binding to Fontconfig. Low-level obviously, but Fontconfig 
> is seriously low level anyway.
>
> Now to work out how to make the project auto generate this D 
> module so as to avoid having it in the repository, and 
> potentially inconsistent with the platform in use.

You could also look at dpp. That's worked for most things I tried 
and was written in part to avoid the problem of macros changing 
behaviour at build time.

Example here:

https://run.dlang.io/?compiler=dmd&source=%23include%20<stdio.h>%0Avoid%20main()%20%7B%0A%20%20%20%20printf("Hello%20dpp.");%0A%7D

https://github.com/atilaneves/dpp




More information about the Digitalmars-d-learn mailing list