Skip to content

Commit 9eadef0

Browse files
Jiaye Wuvaintroub
authored andcommitted
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' ```
1 parent d956709 commit 9eadef0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/my_global.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
10771077
static inline char *dlerror(void)
10781078
{
10791079
static char win_errormsg[2048];
1080-
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
1080+
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
10811081
0, GetLastError(), 0, win_errormsg, 2048, NULL);
10821082
return win_errormsg;
10831083
}

0 commit comments

Comments
 (0)