我調用DLL時出現
project prjoyama.exe raised exception class EAccessViolation with message 'Access violation at address 00373570 in module 'PubFunction.Dll'.Read of address FFFFFFD4'.Prosess stopped.Use Step or Run to continume.
的錯誤再運行時,錯誤如下:
project prjoyama.exe raised exception class EInvalidPointer with message 'Invalid pointer opneration'.Process stopped.Use Step or Run to continume.請幫幫!
project prjoyama.exe raised exception class EAccessViolation with message 'Access violation at address 00373570 in module 'PubFunction.Dll'.Read of address FFFFFFD4'.Prosess stopped.Use Step or Run to continume.
的錯誤再運行時,錯誤如下:
project prjoyama.exe raised exception class EInvalidPointer with message 'Invalid pointer opneration'.Process stopped.Use Step or Run to continume.請幫幫!
procedure LoadToImage(Image :TImage;strICO :String);stdcall;overload;
var
strDir,strFile : string;
begin
GetDir(0,strDir); { 0 = 當前驅動器}
strFile := strDir+strICO;
if FileExists(strFile) then
begin
Image.Picture.LoadFromFile(strFile);
end else
begin
Application.MessageBox('系統找不到背景文件!',PChar('系統訊息'),MB_OK);
end;
end;exports//導入圖片
LoadToImage(Image :TImage;strICO :String);begin
end.編譯通過
sharemem;
加上这个单元;
sharemem;
加上这个单元;或者用參數用PChar:
LoadToImage(Image :TImage;strICO :PChar);
修改,
exports
LoadToImage(Image :TImage;strICO :String);
成
exports
LoadToImage; // 就可!
//不要用string类型!如果你的dll是给vc++等别的语言的话,最好用pchar,如果你要是给你自己的delphi程序用的话,用pchar或shortstring都行,也可加单元sharemem(放在第一位);不过要在你调用该dll的程序中也加入单元sharemem;
to :楼主,这样的错误是很普通的错误!以后的写代码中一定要切记!好运 !
而且主程序程序文件一开始就加一般不出错。
改为:
procedure LoadToImage(Image :TImage;strICO :PChar);stdcall;overload;
dll數據類型很重要