坑爹,二点半了,倒底是DLL有问题还是我写的方法有问题,求教。
静态调用无伤何提示,也不报错。
procedure my_go(); cdecl; external 'my.dll';
动态调用,弹错误,运行到MyRro();时弹出(access violation at 0x10113903:read of address 0x10113903),不知道是什么问题,谢谢帮忙 。
type
TMyPro=procedure();cdecl;
var
MyHandle:Thandle;
MyRro:TMyPro;
begin
try
MyHandle:=LoadLibrary('my.dll');
if MyHandle>0 then ///大于0为DLL装载成功
try
@MyRro:=GetProcAddress(MyHandle,PChar('mygo'));
if @MyRro<>nil then
begin
MyRro();
end
else
ShowMessage(mygo函数没有找到');
finally
FreeLibrary(MyHandle);
end
else
ShowMessage(my.dll没有找到');
except
end;
end;