Comment #0 by alphaglosined — 2024-05-02T22:46:56Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:35:03Z