Consuming D libraries from other languages

Ali Çehreli acehreli at yahoo.com
Wed Jun 15 21:22:27 UTC 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


More information about the Digitalmars-d-learn mailing list