summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhang Zhao <[email protected]>2022-09-01 16:03:42 +0800
committerYuhang Zhao <[email protected]>2022-10-28 12:00:01 +0800
commit8b98b8c8369deb6a677824afdc7b8f856454e76f (patch)
tree50dadf3b3a021a0aa072e39f8ddf1f12d1c72f0f
parent4f8202c239d5558631694341e18ac9d24fde4374 (diff)
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 <[email protected]> Reviewed-by: MÃ¥rten Nordheim <[email protected]>
-rw-r--r--src/entrypoint/qtentrypoint_win.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/entrypoint/qtentrypoint_win.cpp b/src/entrypoint/qtentrypoint_win.cpp
index 6ecb8149480..f0cf46ba3d8 100644
--- a/src/entrypoint/qtentrypoint_win.cpp
+++ b/src/entrypoint/qtentrypoint_win.cpp
@@ -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();
+}