Boost thread doesn't compile on windows if UNICODE is defined

in mutex.inl: if (HMODULE kernel_module = GetModuleHandle(TEXT("KERNEL32.DLL"))) g_TryEnterCriticalSection = reinterpret_cast<TryEnterCriticalSection_type>(GetProcAddress(kernel_module, TEXT("TryEnterCriticalSection"))); The problem is that GetProcAddress() on windows only has ascii version and takes lpcstr as the name of the function to lookup, so if you define UNICODE to do windows unicode build, compiler complains that you're trying to pass WCHAR* as char*. A complication here is with wince, which is the opposite and only takes WCHAR* as the name of the function so the correct code should pass "TryEnterCriticalSection" on non-wince and L"TryEnterCriticalSection" on wince. It also means that successful windows unicode build of boost doesn't seem to be part of release criteria. -- krzysztof kowalczyk

Please submit a Trac ticket at http://svn.boost.org Thanks Thomas Krzysztof Kowalczyk wrote:
in mutex.inl:
if (HMODULE kernel_module = GetModuleHandle(TEXT("KERNEL32.DLL"))) g_TryEnterCriticalSection = reinterpret_cast<TryEnterCriticalSection_type>(GetProcAddress(kernel_module, TEXT("TryEnterCriticalSection")));
The problem is that GetProcAddress() on windows only has ascii version and takes lpcstr as the name of the function to lookup, so if you define UNICODE to do windows unicode build, compiler complains that you're trying to pass WCHAR* as char*.
A complication here is with wince, which is the opposite and only takes WCHAR* as the name of the function so the correct code should pass "TryEnterCriticalSection" on non-wince and L"TryEnterCriticalSection" on wince.
It also means that successful windows unicode build of boost doesn't seem to be part of release criteria.
-- krzysztof kowalczyk _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Thomas Witt witt@acm.org
participants (2)
-
Krzysztof Kowalczyk
-
Thomas Witt