Z
zhangyuntian
Unregistered / Unconfirmed
GUEST, unregistred user!
一个VC写的DLL,用Delphi调用时,可以调用成功,但是就在此过程结束时会出现一具内存存取错误!就是找不出问题!急!请帮我看看呀!
TSySCan_HaveScan=function (ModelNamechar):boolean;stdcall;
调用代码是:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
Mnamechar;
iflag:boolean;
begin
try
GetMem(Mname,30);
if LHandle=0 then
begin
exit;
end;
Mname:=Pchar('IO_HasScanner');
@P1:=GetProcAddress(LHandle,pchar(Mname));
if NOT Assigned(P1) then
begin
exit;
end;
Mname:=Pchar('TrvlScan 464');
if P1(Mname) then //这里本来应该是if NOT P1(Mname) then 我改了一下好测试问
//题就出在一退出此过程就报错
begin
try
if Assigned(Mname) then
Mname:=nil;
except
;
end;
exit;//这里一退出就出错
end;
finally
if LHandle<>0 then
FreeLibrary(LHandle);
showmessage('ddddd');
end
//
end;
TSySCan_HaveScan=function (ModelNamechar):boolean;stdcall;
调用代码是:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
Mnamechar;
iflag:boolean;
begin
try
GetMem(Mname,30);
if LHandle=0 then
begin
exit;
end;
Mname:=Pchar('IO_HasScanner');
@P1:=GetProcAddress(LHandle,pchar(Mname));
if NOT Assigned(P1) then
begin
exit;
end;
Mname:=Pchar('TrvlScan 464');
if P1(Mname) then //这里本来应该是if NOT P1(Mname) then 我改了一下好测试问
//题就出在一退出此过程就报错
begin
try
if Assigned(Mname) then
Mname:=nil;
except
;
end;
exit;//这里一退出就出错
end;
finally
if LHandle<>0 then
FreeLibrary(LHandle);
showmessage('ddddd');
end
//
end;