调用DLL错误,在调试环境下,退出程序时出现非法地址错误。
function Quit(WHandle: HWND): Integer; stdcall;
function Quit; external 'STK.DLL' Name 'Quit';
无论用Register,PASCAL,Stdcall,Cdecl,Safecall那种调用约定模式都无法解决问题,
无论是否执行只要定义了这一DLL引用就出现错误。
...全文
4811打赏收藏
调用DLL错误
调用DLL错误,在调试环境下,退出程序时出现非法地址错误。 function Quit(WHandle: HWND): Integer; stdcall; function Quit; external 'STK.DLL' Name 'Quit'; 无论用Register,PASCAL,Stdcall,Cdecl,Safecall那种调用约定模式都无法解决问题, 无论是否执行只要定义了这一DLL引用就出现错误。
用DLL错误,在调试环境下,退出程序时出现非法地址错误。
function Quit(WHandle: HWND): Integer; stdcall;
function Quit; external 'STK.DLL' Name 'Quit';
无论用Register,PASCAL,Stdcall,Cdecl,Safecall那种调用约定模式都无法解决问题,
无论是否执行只要定义了这一DLL引用就出现错误。
比如
{这是你的代码}
function Quit(WHandle: HWND): Integer; stdcall;
function Quit; external 'STK.DLL' Name 'Quit';//这个有编译时错误和运行时错误两种.
他返回类型没有定义,而且函数没有参数? 正确的调用方式是这样的
function Quit(WHandle: HWND): Integer; stdcall;
function Quit(WHandle: HWND): Integer; external 'STK.DLL' Name 'Quit';stdcall;
或者用动态的
TDllType = function(WHandle: HWND):integer;stdcall;
function test:integer;
var
testfunc:TDllType;
begin
@TestFunc:=GetProcAddress(DllHandle,'Quit');
if @TestFunc<>0 then
Result:=TestFunc(Form1.Handel);
end;