[libcxx-commits] [PATCH] D155278: [libc++][mingw] TLS cleanup on windows

Karl-Johan Johnsson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 14 04:42:03 PDT 2023


kalle-llvm added a comment.

In D155278#4500509 <https://reviews.llvm.org/D155278#4500509>, @jrtc27 wrote:

> Isn't atexit for process termination? I'd be surprised if it really does run during FreeLibrary. The normal (/documented) approach is to handle DLL_PROCESS_DETACH inside DllMain, but many applications also seem to use a C++ destructor, which will compose better with static linking.

On Windows atexit functions run on dll unload, and global destructors are implemented with atexit.  I considered using a global destructor but I wanted to make as small a change as possible.

And it does work, at least for my use case with static linking of libc++/libc++abi/libunwind.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155278/new/

https://reviews.llvm.org/D155278



More information about the libcxx-commits mailing list