Tuesday, August 19, 2014

Re: Windows Subsystem

*** src/Make_mvc.mak.orig 2014-08-20 00:16:40.190961200 +0800
--- src/Make_mvc.mak 2014-08-20 00:19:01.084049100 +0800
***************
*** 657,662 ****
--- 657,666 ----
SUBSYSTEM = console
!endif

+ !if "$(SUBSYSTEM_VER)" != ""
+ SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
+ !endif
+
!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes"
CFLAGS = $(CFLAGS) $(DIRECTX_DEFS)
GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL)
*** src/INSTALLpc.txt.orig 2012-08-29 23:29:09.000000000 +0800
--- src/INSTALLpc.txt 2014-08-20 10:00:07.169603300 +0800
***************
*** 192,197 ****
--- 192,221 ----
Vim with Make_mvc.mak.


+ Targeting Windows XP with new MSVC *new-msvc-windows-xp*
+ ----------------------------------
+
+ Beginning with Visual C++ 2010, Microsoft changed the behavior of LINK.EXE
+ so that it targets Windows 6.0 (Vista) by default. In order to override
+ this, the target Windows version number needs to be passed to LINK like
+ follows:
+ LINK ... /subsystem:console,5.01
+
+ Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version.
+ Use lines like follows to target Windows XP (assuming using Visual C++ 2012
+ under 64-bit Windows):
+ set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A
+ set SDK_INCLUDE_DIR=%WinSdk71%\Include
+ set INCLUDE=%WinSdk71%\Include;%INCLUDE%
+ set LIB=%WinSdk71%\Lib;%LIB%
+ set PATH=%WinSdk71%\Bin;%PATH%
+ set CL=/D_USING_V110_SDK71_
+ nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01
+
+ The following Visual C++ team blog can serve as a reference page:
+ http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx
+
+
2. MinGW
========

OK :-). Patch is attached.

On 20 August 2014 04:01, Bram Moolenaar <Bram@moolenaar.net> wrote:
>
> Yongwei Wu wrote:
>
>> After someone complained to me that my new vim builds could not run on
>> Windows XP, I have realized that MSVC 11 (VS2012) defaults to build
>> for Windows Vista and later, even if WINVER is set to 0x0400 (or
>> 0x0501) and the Windows SDK 7.1A is used. I suggest we patch
>> Make_mvc.mak this way:
>>
>> --- Make_mvc.mak.orig Wed Aug 20 00:16:40 2014
>> +++ Make_mvc.mak Wed Aug 20 00:19:01 2014
>> @@ -657,6 +657,10 @@
>> SUBSYSTEM = console
>> !endif
>>
>> +!if "$(SUBSYSTEM_VER)" != ""
>> +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
>> +!endif
>> +
>> !if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes"
>> CFLAGS = $(CFLAGS) $(DIRECTX_DEFS)
>> GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL)
>>
>> After this change I can now build vim that can run on Windows XP:
>>
>> set SDK_INCLUDE_DIR=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
>> set CL=/D_USING_V110_SDK71_
>> nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01
>>
>> Please consider whether this is a good approach.
>
> I suppose this won't cause problems for anybody else.
>
> How about also updating the INSTALL text to explain building on Windows
> XP?
>
> --
> Nothing is fool-proof to a sufficiently talented fool.
>
> /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///



--
Wu Yongwei
URL: http://wyw.dcweb.cn/

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: