有人能告诉我为什么这段代码在 Delphi 7中可以工作,但在10.4版本中却有内存错误吗?
procedure ChatPrintf(ChatPrintMSG: PChar);
var
ChatPrint: Cardinal;
procedure ChatPrintASM(ChatPrintMSG: PChar); assembler;
asm
lea edx, [ChatPrintMSG]
push edx
call [ChatPrint]
pop edx
end;
begin
ChatPrint := $009E0C30;
ChatPrintASM(ChatPrintMSG);
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
ChatPrintf('it: works');
end;
1条答案
按热度按时间xfb7svmp1#
正如Andreas所提到的,默认的字符串类型已经改变了。最简单的方法是用pansichar替换pchar
新的定义是