Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.1.2, 4.1.3, 4.1.4, 4.2.0, 4.2.1
-
None
-
Windows
-
Incorrect Behavior
Description
From MSDN:
The Visual C++ compiler supports a syntax that enables you to declare thread-local variables: _declspec(thread). If you use this syntax in a DLL, you will not be able to load the DLL explicitly using LoadLibrary on versions of Windows prior to Windows Vista. If your DLL will be loaded explicitly, you must use the thread local storage functions instead of _declspec(thread).
Personally, I've got the Access Violation Exception during performing Boost.Python regression tests, since python.exe process loading the DLL using LoadLibrary() function.
Since the user could make own DLL, linked against stdcxx statically or dynamically, and load this DLL using LoadLibrary() function, we should not use the implicit TLS in stdcxx library to avoid such problems. If we want use thread local variables in stdcxx, we should use TlsAlloc()/TlsFree()/TlsGetValue()/TlsSetValue() functions on Windows.