I have a library written in ISO C++. It doesn’t use Winapi, TCHAR or anything like that. I’m currently building it as a static library with character set set to Unicode. I intend to link it to other libraries, some of them built using Unicode, some – MBCS.
Do I need to create two configurations and build two versions (MBCS and Unicode) in this case?
This is not a problem. Code that uses utf-16 encoded Unicode strings uses wchar_t*, code that uses a legacy 8-bit encoding uses char*. Unambiguous both to the compiler and linker. The only reason the setting exists is because Windows headers and the non-standard
<tchar.h>contain macros that translate a typedef (like TCHAR) to either of those strings types, guided by the UNICODE and _UNICODE #defines.Of course, using this library from a program that uses char* for strings will be an enormous pita. The program must translate the strings, note that a cast won’t do.