- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个程序
{$APPTYPE CONSOLE}
{$TYPEDADDRESS ON}
uses
Winapi.Windows;
procedure Foo(P: PDWORD);
begin
end;
procedure Bar;
var
dw: DWORD;
begin
Foo(@dw);
end;
begin
end.
在 XE3 中编译,但在 XE4、XE5、XE6 和 XE7 中不编译。错误位于
Foo(@dw);
[dcc32 Error] E2010 Incompatible types: 'PDWORD' and 'Pointer'
This feels odd. So, after a bit of digging it seems that the issue is down to the definition of PDWORD
. One might naturally think that it would be:
PDWORD = ^DWORD;
XE3 中确实就是这种情况。在以后的版本中我们发现:
// Note: Not ^DWORD yet
PDWORD = ^CppULongInt;
奇怪。那么,什么是CppULongInt
?
CppULongInt = type LongWord;
{$EXTERNALSYM CppULongInt 'unsigned long'}
{$OBJTYPENAME CppULongInt 'Bul' 'Gm'}
然后查看 DWORD
的声明,我们发现:
//NOTE: DWORD should really be CppULongInt
DWORD = LongWord;
因此,CppULongInt
和 DWORD
是不同的类型。因此出现编译错误。
这是怎么回事? CppULongInt
的用途是什么?为什么 RTL 设计者似乎想要将 DWORD
别名为 CppULongInt
。此更改与基于 LLVM 的 x64 Windows C++ 编译器有关吗?我是世界上唯一使用 {$TYPEDADDRESS ON}
的人吗?
请注意,最后一个问题是反问句。
最佳答案
(指Why PDWORD
is not a pointer to DWORD
。)看起来内河码头有人没有读过the relevant Windows documentation。 :
DWORD
被显式定义为 32 位无符号整数
,因此在 Delphi 中它应该是 UInt32
.PDWORD
被定义为指向 DWORD
的指针,因此在 Delphi 中它应该是 PDWORD = ^DWORD
。DWORD_PTR
(不是 PDWORD
!)被定义为 ULONG_PTR
,后者的大小会根据平台(32 或 64 位),而不是 unsigned long
的编译器定义。原因之一可能是他们试图在非 Windows 平台上使用 DWORD 和其他 Windows 数据类型,并试图保持它们的兼容性。如果是这样,在这种情况下他们会失败并引入错误,因为使用的定义在 Windows 中无法正常工作。
关于delphi - 为什么 PDWord 不是 ^DWORD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25817360/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度理解。包括尝试过的解决方案、为什么它们不起作用,以及预
这个问题在这里已经有了答案: C++ cout hex values? (10 个答案) 关闭 6 年前。 如何在 C++ 中将十进制转换为十六进制?我在 ultoa 上取得了成功,但这给了你一个字
我想在 DWORD 数组中找到不等于 0 的最重要的 DWORD。该算法应该针对最大 128 字节的数据大小进行优化。 我做了三个不同的函数,它们都返回特定 DWORD 的索引。 unsigned l
编译C++项目时出现以下错误。 Error C2664 'BOOL CryptBinaryToStringW(const BYTE *,DWORD,DWORD,LPWSTR,DWORD *)': ca
我开始学习汇编程序,这对我来说似乎不合逻辑。 为什么我不能在一个寄存器中使用多个高字节? 我了解rax的历史原因-> eax -> ax ,所以让我们关注新的 64 位寄存器。例如,我可以使用 r8和
我遇到了一个我无法理解的编译错误。我有两个使用 WLT 8.0 的 C++ 项目。我正在使用 VS2005 来编译两者。一个在 Win XP 或 7 上运行,另一个在 CE 上运行。它们都包含 WLT
所以最近我一直想从汇编中调用一些 win32 调用,并且我一直在使用 NASM 作为我的外部汇编程序。我调用 SendMessage在我的代码中以下列方式: call __imp__SendMessa
从“DWORD (*)(void*)”到“DWORD (*)(void*)”的无效转换。蛋糕==谎言1==0 我不知道这是什么意思......我在这段代码中得到了它 HANDLE CPlugin::C
我很难理解我是否以正确的方式执行此操作以及这是否是(唯一)最佳解决方案。 我正在从事的项目正在使用 Three-Dimensional Array保存和使用大量数据。 “数据”的一部分是 DWORD
这个问题在这里已经有了答案: problems using CreateThread on a member function (1 个回答) 关闭 10 年前。 我试图在类中创建线程,但出现错误。
我在这个网站上搜索了一个答案,但最重要的答案对我不起作用,我一直收到这个错误。我最近(不确定我是否成功)将我的项目从我的台式机导入到我的新笔记本电脑,没有任何错误。每当我尝试运行时,我都会在多个文件中
我想连接 2 个非字符串类型,这样我就可以将它们用作一个。这是我的代码的主要部分: #include #include #include int main() { HANDLE hwnd =
对于这个问题,汇编语言中用一下方法处理。 (1)通过寄存器名指明要处理的数据的尺寸。 例如: 下面的指令中,寄存器指明了指令进行的是字操作: mov ax,1 mov bx,ds:[0] mov
你好,我正在尝试在 intel32 上安装程序集, 我的完整问题是,这是什么意思? mov dword ptr [esp+18h], 0AH 我特别没有得到 [esp+18h] 的部分 最佳答案 中括
如果使用汇编语言 mov eax, dword ptr[ebx] 那么这意味着复制ebx指向的值(ebx包含地址值,而不是实际值,此指令将实际值复制到地址中)? 如果我们使用 mov eax, dwo
这个问题已经有答案了: Getting hex through Cin (5 个回答) 已关闭 8 年前。 我需要从 unsigned long 进行转换(十六进制)到 DWORD . 我通常会 DW
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 7 年前。 Improve t
我收到此错误且无法更正。任何帮助表示赞赏。谢谢。错误 C2440:“=”:无法从“DWORD *”转换为“unsigned int”IntelliSense:“DWORD *”类型的值不能分配给“un
我正在尝试将带符号的浮点变量转换为 DWORD...DWORD 将由另一个程序使用,因此 DWORD 变量类型很重要... 首先...可以将带符号的 DWORD 解释为未签名的 DWORD...吗?
在 C++ 中,我可以简单地将指针转换为 DWORD 吗? MyClass * thing; DWORD myPtr = (DWORD)thing; 那行得通吗? 最佳答案 毫无疑问,您可以做到。 它
我是一名优秀的程序员,十分优秀!