From 681cda02bf656c1cc114632d60afc8bd0cac4b09 Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Tue, 2 Dec 2014 13:33:42 +0100 Subject: [PATCH] VS, WINCE: Fix entry point for Unicode builds When _UNICODE is defined VS uses wmain instead of main as the entry function. To make this correctly work on WindowsCE EntryPointSymbol needs to be set to mainWCRTStartup instead of mainACRTStartup for console applications and to wWinMainCRTStartup instead of WinMainCRTStartup for GUI applications. Signed-off-by: Pascal Bach --- Source/cmVisualStudio10TargetGenerator.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 26fc317bc..2ef27e2a9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2267,7 +2267,14 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AddFlag("SubSystem", "WindowsCE"); if (this->Target->GetType() == cmTarget::EXECUTABLE) { - linkOptions.AddFlag("EntryPointSymbol", "WinMainCRTStartup"); + if (this->ClOptions[config]->UsingUnicode()) + { + linkOptions.AddFlag("EntryPointSymbol", "wWinMainCRTStartup"); + } + else + { + linkOptions.AddFlag("EntryPointSymbol", "WinMainCRTStartup"); + } } } else @@ -2282,7 +2289,14 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AddFlag("SubSystem", "WindowsCE"); if (this->Target->GetType() == cmTarget::EXECUTABLE) { - linkOptions.AddFlag("EntryPointSymbol", "mainACRTStartup"); + if (this->ClOptions[config]->UsingUnicode()) + { + linkOptions.AddFlag("EntryPointSymbol", "mainWCRTStartup"); + } + else + { + linkOptions.AddFlag("EntryPointSymbol", "mainACRTStartup"); + } } } else