From c74fe188b178fab821084bb82d4574f77dc2e1ce Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 10 Dec 2012 19:33:43 +0200 Subject: Create executables that can be run on Windows XP Specify subsystem version 5.01 in the linker options. Otherwise, when built with the linker in Windows Kit 8.0, executables are created with the "operating system version" and "subsystem version" fields set to 6.0 (which means Vista). Attempting to run such executables on Windows XP fails with an error that claims them to be "invalid Win32 executables" (which is a blatant lie, of course). We can well set the subsystem version to 5.01 as we don't unconditionally use any APIs that wouldn't be present on XP. Note that you need Visual Studio 2012 Update 1 to be able to create code that runs on XP. The original version creates executables that importx entries from kernel32.dll like GetTickCount64 that aren't present on XP. Apparently it doesn't hurt on XP that DLL headers specify a "too new" subsystem version. --- solenv/gbuild/platform/com_MSC_class.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index ed08ec31cb19..2d4d19e048d7 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -187,7 +187,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ $(if $(filter StaticLibrary,$(TARGETTYPE)),$(gb_StaticLibrary_TARGETTYPEFLAGS)) \ $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \ - $(if $(filter YES,$(TARGETGUI)), -SUBSYSTEM:WINDOWS, -SUBSYSTEM:CONSOLE) \ + $(if $(filter YES,$(TARGETGUI)), -SUBSYSTEM:WINDOWS$(COMMA)5.01, -SUBSYSTEM:CONSOLE$(COMMA)5.01) \ $(if $(filter YES,$(LIBRARY_X64)), -MACHINE:X64) \ $(if $(filter YES,$(LIBRARY_X64)), -LIBPATH:$(OUTDIR)/lib/x64 -LIBPATH:$(COMPATH)/lib/amd64 -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x64 \ $(if $(filter 80,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/win8/um/x64,),) \ -- cgit