digitalmars.D.learn - Consuming D libraries from other languages
- Templated Person (6/6) Jun 15 2022 It there any resources on how to build D static (`.lib` / `.a`)
- Guillaume Piolat (8/15) Jun 15 2022 What I would suggest is to look at a few of the BindBC libraries
- Guillaume Piolat (4/6) Jun 15 2022 My bad I understood the reverse, consuming C libraries from D.
- =?UTF-8?Q?Ali_=c3=87ehreli?= (13/20) Jun 15 2022 I had difficulty figuring out how everything fit together in a
- mw (6/13) Jun 15 2022 Check:
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?
Jun 15 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.
Jun 15 2022
On Wednesday, 15 June 2022 at 19:36:34 UTC, Guillaume Piolat wrote:BindBC bindings are multi-platform and can be both static and dynamic linking.My bad I understood the reverse, consuming C libraries from D. I think what you are seeking is described in the D blog.
Jun 15 2022
On 6/15/22 10:37, 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?Not Phobos but the D runtime.What if I don't want to use the D runtime? What happens with module level `this()` and `~this()`?I had difficulty figuring out how everything fit together in a complicated scenario. (Different language runtimes calling each other and starting the D library.) However the following worked.Is there a comprehensive guide on how to do this stuff?I gave a DConf presentation that answers some of your questions: https://dconf.org/2020/online/ Please click the 'November 22' tab on that page to expand "Exposing a D Library to Python Through a C API". But here are the links: Slides: https://dconf.org/2020/online/slides/ali-2.pdf Video: https://youtu.be/FNL-CPX4EuM Q&A: https://youtu.be/M5wtRgfAoAA Ali
Jun 15 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?Check: https://code.dlang.org/packages/autowrap https://github.com/symmetryinvestments/autowrap/tree/master/examples
Jun 15 2022