我有一个测试程序https://gist.github.com/real-mielofon/5002732
RttiValue := RttiMethod.Invoke(RttiInstance, [10]);和带有接口的简单单元:
unit Unit163;
interface
type
{$M+}
ISafeIntf = interface
function TestMethod(aI: integer): integer; safecall;
end;
{$M-}
type
TSafeClass = class(TInterfacedObject, ISafeIntf)
public
function TestMethod(aI: integer): integer; safecall;
end;
implementation
function TSafeClass.TestMethod(aI: integer): integer;
begin
result := aI+1; // Exception !!
end;
end.我穿上了卡波姆
result := aI+1;如果它是过程或不安全的调用,那么它是正常的:-(
发布于 2013-02-21 15:32:45
现在我自己尝试过了,并查看了代码,我的结论是有一个bug。RTTI单元确实尝试执行safecall方法重写。它似乎就是搞错了。我建议您以QC报告的形式提交您的项目,并通过使用带有HRESULT返回值的stdcall来解决此问题。
https://stackoverflow.com/questions/14996078
复制相似问题