boostorg / build

B2 makes it easy to build C++ projects, everywhere.
Boost Software License 1.0
230 stars 48 forks source link

b2 does not build using MSVC with Unicode support (/DUNICODE) #542

Closed mloskot closed 4 years ago

mloskot commented 4 years ago

The b2 driver code implicitly assumes use of ANSI version of Win32 API functions, e.g.

char buf[ 1024 ];
DWORD const ret = GetModuleFileName( NULL, buf, sizeof( buf ) );

Obviously, attempts to compile with cl /DUNICODE will fail due to char* to wchar_t* conversions as GetModuleFileName resolves to GetModuleFileNameW.

There either should be an early exit somewhere

#if defined(UNICODE) || defined(_UNICODE)
#error "Building with C run-time support for Unicode is not supported"
#endif

or ANSI variants of Win32 API functions should be preferred, change from GetModuleFileName to GetModuleFileNameA, etc.

grafikrobot commented 4 years ago

I like being explicit, and hence we should use the ANSI variants. At least until some future when we can make b2 support unicode.