May 02 [Issue 24532] New: Add pragma to set function as a TLS callback function for Windows | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24532 Issue ID: 24532 Summary: Add pragma to set function as a TLS callback function for Windows Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: alphaglosined@gmail.com The ``DllMain`` function on Windows is an optional /user/ function for being notified of when a binary load/unload or thread constructs and destructs. However, it is not really an entry point function akin to ``main``. It should be viewed as one of many call-back functions for TLS. https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#tls-callback-functions Having a pragma to set a function as one of these, would enable multiple library notifications without tying up and using the ``DllMain`` function. For druntime this is especially important if you want that to be a static library, preventing the need for ``SimpleDllMain`` to exist. Related: https://issues.dlang.org/show_bug.cgi?id=23756 which is about thread hooks similar to crt_constructor. -- |
Copyright © 1999-2021 by the D Language Foundation