windows 会有 Win64 API 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7476814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:07:12  来源:igfitidea点击:

Will there be a Win64 API?

windowswinapi64-bit32bit-64bit

提问by Ell

If I'm correct, Win32 is adapting or has been adapted to cope with 64 bit windows, for example, GetWindowLongPtr on 64 bit as opposed to GetWindowLong on 32 bit. Will there be a Win64 Api, and if so, is there any indication on when the transition will happen?

如果我是对的,Win32 正在适应或已经适应以应对 64 位窗口,例如,64 位的 GetWindowLongPtr 而不是 32 位的 GetWindowLong。是否会有 Win64 Api,如果有,是否有任何关于何时发生转换的迹象?

I'm not very knowledgeable on this subject so I apologize if I have anything obvious wrong. Thanks in advance, ell.

我对这个主题不是很了解,所以如果我有任何明显的错误,我深表歉意。提前致谢,嗯。

回答by David Heffernan

This transition happened around the turn of the century. 64 bit versions of Windows using the 64 bit version of Win32 have been in use for a long time now.

这种转变发生在世纪之交。使用 64 位版本的 Win32 的 64 位版本的 Windows 已经使用了很长时间。

However, the 64 bit version of Win32 is still known as Win32 since it is essentially an identical interface with the only major difference being different sized pointers.

然而,Win32 的 64 位版本仍然被称为 Win32,因为它本质上是一个相同的接口,唯一的主要区别是不同大小的指针。

回答by Reed Copsey

The new Windows API, just announced, is called WinRT. For more information, I recommend watching the keynotes from BUILD.

刚刚宣布的新 Windows API 称为 WinRT。有关更多信息,我建议观看BUILD的主题演讲。

回答by Jeffrey Hantin

The Windows API has suffered terribly from the habit of assuming a known value of sizeof(void *)and sticking it in a field of some integral type believed to be the same size. Even in the Windows MSGstructure, wParamis so named because it was originally a WORD, or unsigned 16 bit value, and lParama LONG, or signed 32 bit value. Perhaps this is another symptom of C Programmers' Disease.

Windows API 习惯于假设一个已知的值sizeof(void *)并将其固定在某个被认为具有相同大小的整数类型的字段中,这给它带来了严重的影响。即使在WindowsMSG结构中wParam之所以如此命名是因为它最初是一个 WORD,或无符号的 16 位值,以及lParam一个 LONG,或有符号的 32 位值。也许这是C程序员病的另一个症状。

回答by Jeffrey Hantin

The win32 stuff ("Win32 API") in x64 is really 64-bit code through-and-through (* see comments).

x64 中的 win32 内容(“Win32 API”)实际上是直通的 64 位代码(* 见注释)。

The actual 32-bit code (in a 64-bit windows) runs under the WoW64subsystem which encompasses both the file-system and registry. While this may seem "sloppy" it actually makes a good bit of sense because a program can be compiled for both x32 and x64 without needing to change names (so long as proper version-neutral code has been used) -- that is, the core interface and "how windows works" is a fairly stable target.

实际的 32 位代码(在 64 位窗口中)在包含文件系统和注册表的WoW64子系统下运行。虽然这可能看起来“草率”,但它实际上很有意义,因为可以为 x32 和 x64 编译程序而无需更改名称(只要使用了正确的版本中立代码)——也就是说,核心界面和“windows 的工作原理”是一个相当稳定的目标。

Happy coding.

快乐编码。