Interfacing with C libs: weeding through C/C++ macros and such in header files

Alec Stewart alec-stewart at protonmail.com
Sun Jan 13 23:57:55 UTC 2019


On Sunday, 13 January 2019 at 23:23:50 UTC, Alex wrote:
> These three are members of the standard library in D.
> https://dlang.org/phobos/core_memory.html
>


Ah, yea that's way easier.

> At first, I would suggest to try out some automatic converters, 
> which are written by the community:
> https://wiki.dlang.org/Bindings#Binding_generators
> especially dstep and dpp
>


That would make it easier because there's a lot of preprocessor 
stuff that ends up being circular references if I use `enum` or 
`const`.

> Also, if there is a possibility to compile the C/C++ library, 
> you could provide the interface only to the functions you need. 
> Then, you reuse the existent code directly and interface the 
> library by declaring the interfaces as extern in your D sources.
> https://dlang.org/spec/attribute.html#linkage


That would also be easier. :P Thanks!


More information about the Digitalmars-d-learn mailing list