Calling D library from other languages on linux using foreign threads

Ali Çehreli acehreli at yahoo.com
Sat Mar 23 15:28:34 UTC 2019


On 03/22/2019 12:34 PM, tchaloupka wrote:
 > I've searched a lot at it should be working at least on linux, but
 > apparently is not or I'm doing something totally wrong..
 >
 > Our use case is to call shared D library from C# (.Net Core) and from
 > different threads.

We needed to do the same from Java. I opened this discussion:

   https://forum.dlang.org/thread/p0dm8f$ij5$1@digitalmars.com

and abandoned this pull request:

   https://github.com/dlang/druntime/pull/1989

We didn't need to pursue this further because the person who was pushing 
for D was leaving the company, so he rewrote the library in C++ before 
doing so.

I don't think it's possible to call into D's GC from another thread in a 
safe way. If I remember correctly, there is no absolute way in POSIX (or 
just Linux?) of knowing that a foreign thread has died. D's GC would be 
holding on to an already dead thread.

Ali



More information about the Digitalmars-d-learn mailing list