在代码环境下运行程序时 提示
---------------------------
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 程序后  再运行 都正常 这是为什么啊?

解决方案 »

  1.   

    访问错误,没代码不能搞.看似是调用DLL出错,你就从调用这个DLL的代码着手.这个DLL可看出,调用C的DLL,你搜搜网上的DELPHI调用C OR CPP 的示例参考一下.
      

  2.   

    在dll工程文件里 加uses
      ShareMem,
    这个单元试试看,dll需要blmm的内存管理模块。你那点估计是字符串操作的问题
      

  3.   

    为什么带代码里 运行时 提示错误   而生成EXE 文件后 运行EXE文件就都正常没有问题?
    这点我有点搞不明白
      

  4.   

    就像前面说的,这个错误是访问DLL时出的错。
      

  5.   


    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;
      

  6.   

    suc := InsertImputInfo(Pchar(adoGetdata.FieldByName('ABC').AsString),DataBuffer); 
     执行到这里 再往下就提示 那个错误
      

  7.   

    GetMem(DataBuffer,2500);
    FreeMem(DataBuffer,1500);
    后面的数字不一样也可以吗?
      

  8.   

    直接FreeMem(DataBuffer)就可以了