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.
"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."
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 /docs.microsoft .com/en- us/windows/ win32/dlls/ dynamic- link-library- best-practices
https:/
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 https:/ /docs.microsoft .com/en- us/windows/ win32/dlls/ dllmain )