Windows specific: MS C++ versus D thread local variables

NonNull non-null at use.startmail.com
Mon Nov 28 18:51:37 UTC 2022


On Saturday, 26 November 2022 at 23:36:13 UTC, NonNull wrote:
> In the CLR module I have a static variable that can contain a 
> reference to a .NET object. I need that variable to be thread 
> local. I achieved this by prefixing its declaration with 
> [System::ThreadStaticAttribute]. But this is thread local for 
> .NET concurrency. How will this variable behave with a 
> multi-threaded D program (that calls those exported library 
> functions from more than one thread) and why?

I tested this with D threads and it works for my test program. I 
might guess that this is so in general, because such a library 
has to successfully work with arbitrary MS VC++ and that 
"interop" is defined by MS to work.



More information about the Digitalmars-d-learn mailing list