March 03, 2023
https://issues.dlang.org/show_bug.cgi?id=23756

          Issue ID: 23756
           Summary: Add thread local constructor/destructor pragma
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: alphaglosined@gmail.com

It is necessary to have a libc-based constructor/destructor at the thread level.

This would replace DllMain for thread initialization and allow us to do TLS initialization in -betterC (although we may want to switch to it outright, for threads not registered with runtime).

Some MSVC specific details:

https://lallouslab.net/2017/05/30/using-cc-tls-callbacks-in-visual-studio-with-your-32-or-64bits-programs/

--