Consuming D libraries from other languages

Guillaume Piolat first.last at gmail.com
Wed Jun 15 19:36:34 UTC 2022


On Wednesday, 15 June 2022 at 17:37:32 UTC, Templated Person 
wrote:
> It there any resources on how to build D static (`.lib` / `.a`) 
> and dynamic libraries (`.dll` / `.so`), and then use them from 
> C?
>
> Do I need to link and initialize phobos somehow? What if I 
> don't want to use the D runtime? What happens with module level 
> `this()` and `~this()`? Is there a comprehensive guide on how 
> to do this stuff?

What I would suggest is to look at a few of the BindBC libraries 
and mimic them.
https://code.dlang.org/search?q=bindbc

BindBC bindings are multi-platform and can be both static and 
dynamic linking.
They can also work without a D runtime.



More information about the Digitalmars-d-learn mailing list