Fix UNICODE issue of dlerror

Current implementation is conflicting. If UNICODE is defined, FormatMessage() will be FormatMessageW(), and variable win_errormsg with type char can not be passed to it, which should be changed to TCHAR instead. Since we don't use UNICODE here, we can use FormatMessageA() directly to avoid conversion error.
```
my_global.h(1092): error C2664: 'DWORD FormatMessageW(D
WORD,LPCVOID,DWORD,DWORD,LPWSTR,DWORD,va_list *)' : cannot convert argument 5 from 'char [2048]' to 'LPWSTR'
```
This commit is contained in:
Jiaye Wu 2018-12-12 15:05:14 +08:00 committed by Vladislav Vaintroub
parent d956709b4b
commit 9eadef013e

View file

@ -1077,7 +1077,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
static inline char *dlerror(void) static inline char *dlerror(void)
{ {
static char win_errormsg[2048]; static char win_errormsg[2048];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
0, GetLastError(), 0, win_errormsg, 2048, NULL); 0, GetLastError(), 0, win_errormsg, 2048, NULL);
return win_errormsg; return win_errormsg;
} }