我必须将Pointer类型的参数从外部DLL传递给函数。
发布于 2010-09-06 11:34:24
只需使用@MyProcedure即可。
注意,它必须有正确的调用约定(可能是stdcall)。
通常不能使用成员函数,因为它有一个隐藏的SELF参数。
不过,class static方法的作用与通常的过程/函数类似。
http://docwiki.embarcadero.com/RADStudio/en/Methods
发布于 2010-09-09 08:43:10
如果过程(或函数)是方法,则创建此类型
type
TMyProc = Procedure(x:Integer;y:Integer) of Object;或者这个
type
TMyProc = Procedure(x:Integer;y:Integer);如果程序是独立的。
用法:
//Some class method
Procedure TfrmMain.Add(x:Integer;y:Integer);
begin
...
end;
//Another class method that uses procedure as parameter
procedure Name(proc : TMyProc);
begin
...
end;
//Call with:
Name(Add);https://stackoverflow.com/questions/3651015
复制相似问题