Win32: Add a W version entry point
Currently we have a narrow version entry point, add a wide version entry point as well, make them share exactly the same implementation. The linker can choose the appropriate entry point during linking. The linker will always try to use wWinMain as the entry point function if the UNICODE/_UNICODE macros are passed to it and this will cause compilation failures without a wWinMain implementation. This patch fixes such issue, though it usually won't happen in most cases. Change-Id: I7bc22d5bdc1cf35514a335a280a9f18732531b25 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
4f8202c239
commit
8b98b8c836
@ -36,7 +36,7 @@ static inline char *wideToMulti(unsigned int codePage, const wchar_t *aw)
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int /* cmdShow */)
|
||||
static inline int qtEntryPoint()
|
||||
{
|
||||
int argc = 0;
|
||||
wchar_t **argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
@ -53,3 +53,13 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int
|
||||
delete [] argv;
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
extern "C" int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
return qtEntryPoint();
|
||||
}
|
||||
|
||||
extern "C" int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
|
||||
{
|
||||
return qtEntryPoint();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user