Opened 15 years ago

Closed 15 years ago

#996 closed Bugs (fixed)

boost threads doesn't build on windows with UNICODE

Reported by: arvid@… Owned by: Anthony Williams
Milestone: Boost 1.34.1 Component: thread
Version: Boost 1.34.0 Severity: Showstopper
Keywords: Cc: kkowalczyk@…, witt@…

Description

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.

Attachments (1)

mutex.inl.patch (964 bytes ) - added by Anthony Williams 15 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Thomas Witt, 15 years ago

Cc: witt@… added
Milestone: Boost 1.34.1
Severity: ProblemShowstopper
Version: release 1.34.0

comment:2 by Anthony Williams, 15 years ago

Status: newassigned

by Anthony Williams, 15 years ago

Attachment: mutex.inl.patch added

comment:3 by Thomas Witt, 15 years ago

Resolution: fixed
Status: assignedclosed

Patch applied.

Note: See TracTickets for help on using tickets.