Comment 2 for bug 1879532

The thread it is waiting on seems to be stuck in "common_end_thread" in ucrtbase, calling ca_context_destroy() from main() with no DLL involved works correctly.

There are various guidelines on what you should and should not do from inside a dllMain() function
Unfortunately using a file level static class does not help as the same rules would appear to apply

"If your DLL is linked with the C run-time library (CRT), the entry point provided by the CRT calls the constructors and destructors for global and static C++ objects. Therefore, these restrictions for DllMain also apply to constructors and destructors and any code that is called from them."

(from )