Re: [patch] has(win64) returns 0 in 64-bit Vim

2010-03-11 Fir de Conversatie Tony Mechelynck

On 05/01/10 20:30, Matt Wozniski wrote:

On Tue, Jan 5, 2010 at 2:17 PM, Sergey Khorev wrote:

Well,


Isn't that only checking the type of CPU that the vim binary was built
with, instead of whether it was built as an x64 binary?  Or does
defining WIN64 cause an x64 binary to be built instead?


CPU in makefile defines target CPU.
-DWIN64 passed to compiler does nothing besides pointing out to source
code we are targeting x64 or IA64.


OK, then.


I'm not sure what has(win64) should be returning based only on
reading the help, but I'd imagine it should either be a) whether the
vim binary itself is a 64 bit binary, or  b) whether the OS that the
binary is running on is a 64-bit version of windows.  The latter seems
more useful, but I'm not sure just from the help.  If I'm right,
though, it would have to be a runtime test; nothing at compile time
could do the trick.


Source code clearly states it was meant as a compile-time check:
#ifdef WIN64
win64,
#endif

Honestly, I'm not sure what's the point in knowledge what OS version
we are running.


I can conceive of a plugin that dynamically loads a DLL - or another
program - that requires a 64-bit windows, which would need to know
that the host OS supports it.  In this case, you'd want to know that
the OS is 64 bit, even if the vim binary is 32-bit.  But as I said, I
can see the argument either way.  It should obviously be consistent
with whatever win16 and win32 do, so if they're compile-time
architecture checks, all is fine.

~Matt



There is more: in Vim versions built before the +foobar feature was 
defined, has('foobar') returns zero by design. This means that a has() 
feature which would return 1 for this is a 32-bit version of Vim 
running on a 64-bit OS would necessarily be unreliable.



Best regards,
Tony.
--
I've enjoyed just about as much of this as I can stand.

--
You received this message from the vim_dev 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


Re: [patch] has(win64) returns 0 in 64-bit Vim

2010-01-05 Fir de Conversatie Matt Wozniski
On Tue, Jan 5, 2010 at 8:52 AM, Sergey Khorev wrote:
 Hi,

 has(win64) returns 0 even for x64 version of Vim. It seems we need
 to define WIN64 for this to work. Something like that:

 *** ../vim72.323/src/Make_mvc.mak       Wed Dec 23 09:36:54 2009
 --- src/Make_mvc.mak    Tue Jan  5 16:46:26 2010
 ***
 *** 314,319 
 --- 314,323 
  # end of choices
  ###

 + !if ($(CPU) == AMD64) || ($(CPU) == IA64)
 + CFLAGS=$(CFLAGS) -DWIN64
 + !endif
 +
  !ifdef OS
  OS_TYPE       = winnt
  DEL_TREE = rmdir /s /q


 --
 Sergey Khorev
 http://sites.google.com/site/khorser
 Can anybody think of a good tagline I can steal?

Isn't that only checking the type of CPU that the vim binary was built
with, instead of whether it was built as an x64 binary?  Or does
defining WIN64 cause an x64 binary to be built instead?

I'm not sure what has(win64) should be returning based only on
reading the help, but I'd imagine it should either be a) whether the
vim binary itself is a 64 bit binary, or  b) whether the OS that the
binary is running on is a 64-bit version of windows.  The latter seems
more useful, but I'm not sure just from the help.  If I'm right,
though, it would have to be a runtime test; nothing at compile time
could do the trick.

~Matt
-- 
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php

Re: [patch] has(win64) returns 0 in 64-bit Vim

2010-01-05 Fir de Conversatie Sergey Khorev
Well,

 Isn't that only checking the type of CPU that the vim binary was built
 with, instead of whether it was built as an x64 binary?  Or does
 defining WIN64 cause an x64 binary to be built instead?

CPU in makefile defines target CPU.
-DWIN64 passed to compiler does nothing besides pointing out to source
code we are targeting x64 or IA64.

 I'm not sure what has(win64) should be returning based only on
 reading the help, but I'd imagine it should either be a) whether the
 vim binary itself is a 64 bit binary, or  b) whether the OS that the
 binary is running on is a 64-bit version of windows.  The latter seems
 more useful, but I'm not sure just from the help.  If I'm right,
 though, it would have to be a runtime test; nothing at compile time
 could do the trick.

Source code clearly states it was meant as a compile-time check:
#ifdef WIN64
win64,
#endif

Honestly, I'm not sure what's the point in knowledge what OS version
we are running.

-- 
Sergey Khorev
http://sites.google.com/site/khorser
Can anybody think of a good tagline I can steal?
-- 
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php

Re: [patch] has(win64) returns 0 in 64-bit Vim

2010-01-05 Fir de Conversatie Matt Wozniski
On Tue, Jan 5, 2010 at 2:17 PM, Sergey Khorev wrote:
 Well,

 Isn't that only checking the type of CPU that the vim binary was built
 with, instead of whether it was built as an x64 binary?  Or does
 defining WIN64 cause an x64 binary to be built instead?

 CPU in makefile defines target CPU.
 -DWIN64 passed to compiler does nothing besides pointing out to source
 code we are targeting x64 or IA64.

OK, then.

 I'm not sure what has(win64) should be returning based only on
 reading the help, but I'd imagine it should either be a) whether the
 vim binary itself is a 64 bit binary, or  b) whether the OS that the
 binary is running on is a 64-bit version of windows.  The latter seems
 more useful, but I'm not sure just from the help.  If I'm right,
 though, it would have to be a runtime test; nothing at compile time
 could do the trick.

 Source code clearly states it was meant as a compile-time check:
 #ifdef WIN64
        win64,
 #endif

 Honestly, I'm not sure what's the point in knowledge what OS version
 we are running.

I can conceive of a plugin that dynamically loads a DLL - or another
program - that requires a 64-bit windows, which would need to know
that the host OS supports it.  In this case, you'd want to know that
the OS is 64 bit, even if the vim binary is 32-bit.  But as I said, I
can see the argument either way.  It should obviously be consistent
with whatever win16 and win32 do, so if they're compile-time
architecture checks, all is fine.

~Matt
-- 
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php

Re: [patch] has(win64) returns 0 in 64-bit Vim

2010-01-05 Fir de Conversatie Sergey Khorev
Matt,

 I can conceive of a plugin that dynamically loads a DLL - or another
 program - that requires a 64-bit windows, which would need to know
 that the host OS supports it.  In this case, you'd want to know that
 the OS is 64 bit, even if the vim binary is 32-bit.  But as I said, I
 can see the argument either way.  It should obviously be consistent
 with whatever win16 and win32 do, so if they're compile-time
 architecture checks, all is fine.

I'm afraid you cannot load 64-bit DLL into 32-bit process even in x64
Windows. In fact, that was why I looked into has(win64)

-- 
Sergey Khorev
http://sites.google.com/site/khorser
Can anybody think of a good tagline I can steal?
-- 
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php

Re: [patch] has(win64) returns 0 in 64-bit Vim

2010-01-05 Fir de Conversatie Sergey Khorev
Hi,

 In many places in the code _WIN64 is checked for, but the list for has()
 uses WIN64.

 Perhaps we should change them all to WIN64 to be consistent with WIN32,
 and then define WIN64 in vim.h when _WIN64 is defined.

That will be inconsistent with WIN32 because it is defined in Makefile :)
What about changing all occurrences of _WIN64 to WIN64 and defining
WIN64 in makefile?

On second thought, I don't like either ways. It seems more consistent
to change the single occurrence of WIN64 in eval.c to _WIN64. Anyway,
64-bit binary returns 1 for has(win32) so we don't have to make
WIN64 to behave like another WIN32.

-- 
Sergey Khorev
http://sites.google.com/site/khorser
Can anybody think of a good tagline I can steal?
-- 
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php