在代码环境下运行程序时 提示
---------------------------
Debugger Exception Notification
---------------------------
Project ABC.exe raised exception class EAccessViolation with message 'Access violation at address 77C12A16 in module 'msvcrt.dll'. Read of address 30313048'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
可是如果编译成.EXE 程序后 再运行 都正常 这是为什么啊?
ShareMem,
这个单元试试看,dll需要blmm的内存管理模块。你那点估计是字符串操作的问题
这点我有点搞不明白
Function InsertOutputInfo(ckdh :PChar ; outMs :PChar):Integer;export;stdcall;far;external DllName name 'InsertOutputInfo';
procedure Tfrm_postoyb.RK_Into_yb;
var
DataBuffer :pchar;
suc : integer;
s_str :String;
begin
try
GetMem(DataBuffer,2500);
try adoGetdata.Close;
adoGetdata.SQL.Clear;
adoGetdata.SQL.Add(' SELECT ABC FROM TABLEA ');
adoGetdata.open;
//写入
while not adoGetdata.Eof do
begin
//写入
suc := -1;
suc := InsertImputInfo(Pchar(adoGetdata.FieldByName('ABC').AsString),DataBuffer); //执行到这里 再往下就提示 那个错误
if suc=0 then
begin
Memo1.Lines.Add('返回信息: '+ strpas(DataBuffer));
updateSQL(adoGetdata.fieldbyname('ABC').AsString,1);
end else
begin
abort;
end;
adoGetdata.next;
end;
except
Memo1.Lines.Add('失败信息:'+ strpas(DataBuffer));
adoGetdata.next;
end;
finally
FreeMem(DataBuffer,1500);
end;
end;
执行到这里 再往下就提示 那个错误
FreeMem(DataBuffer,1500);
后面的数字不一样也可以吗?