Open walbourn opened 1 year ago
Ugh. The Win32 API just confuses the hell out of me! But thanks for the tip. Let me know if you spot anything else. I'll look to get a little fix release out in the next few weeks.
BTW... If you have a suggestion for a better way to do this, let me know.
Blame on back-compat with 16-bit Windows and the transition from ANSI to Unicode :)
LoadLibrary
and FormatMessage
aren't actually functions. They are just macros based on MBCS vs. UNICODE settings. By explicitly calling LoadLibraryA
you are ignoring those crazy macros. For more information on why this is a 'best practice' these days, see UTF-8 Everywhere.
Ha. Yeah, I'm so old, the last time I programmed Windows professionally, I was dealing with segments and offsets, not Unicode! I didn't realize those agnostic "functions" were actually macros. Thanks.
It's all part of the TCHAR
and Uniscribe pain that was Windows 9x :)
Per the UTF-8 Everywhere Manifesto, it's best to not rely on the legacy ANSI .vs UNICODE macros for Win32 functions that take strings. Since you explicitly use an ANSI string for the call to
LoadLibrary
you should explicitly use theLoadLibraryA
method.In exception.cpp use
FormatMessageA
instead ofFormatMessage
.