Druntime without pthreads?

sarn sarn at theartofmachinery.com
Tue Oct 20 22:31:29 UTC 2020

On Tuesday, 20 October 2020 at 16:58:12 UTC, Severin Teona wrote:
> Hi guys.
> I have a curiosity, regarding [1] - I had encountered some 
> "undefined reference" errors when trying to link the druntime 
> (compiled for an embedded architecture) without some 
> implementation of the POSIX thread calls (and other stuff too).
> My curiosity is what would change if I removed from the 
> druntime everything that has to do with mutexes or threads. 
> Would it be possible for the druntime to run and work properly 
> on a microcontroller - where those concepts are not necessary? 
> Could I just remove everything about synchronisation from the 
> druntime, and classes or Garbage Collector to still work 
> properly?
> [1]: 
> https://forum.dlang.org/post/erwfgtigvcciohllvaos@forum.dlang.org

An alternative would be to link to a custom library that 
implements the pthreads ABI, but stubs everything out in a way 
that makes sense on a single-threaded microcontroller.

I wanted to do that once for another project.  I never got it to 
work for unrelated reasons, so I can't say how well the D runtime 
handles it, sorry.  It's probably an easier approach than 
maintaining your own fork of the runtime, though.

More information about the Digitalmars-d-learn mailing list