load vc++ DLL,请教 |
|
wxss2008
一般會員 發表:1 回覆:0 積分:0 註冊:2006-08-24 發送簡訊給我 |
我要用delphi调一个vc++的DLL
在vc里的声明为:int myfunc(char const *, int, class CString &) 我的delphi source: type TDLLFunc = function (const ss: PChar; i: integer; var param2: string): boolean; {assign a nil - not loaded function} const DLLFunc: TDLLFunc = nil; DLLName = 'my.dll'; {handle of loaded dll} procedure TForm1.Button1Click(Sender: TObject); var DLLHandle: THandle; s:string; begin { load a library } DLLHandle := LoadLibrary(DLLName); if (DLLHandle < HINSTANCE_ERROR) then raise Exception.Create(DLLName ' library can not be loaded or not found. ' SysErrorMessage(GetLastError)); try { load an address of required procedure} @DLLFunc := GetProcAddress(DLLHandle, 'myfunc'); {if procedure is found in the dll} if Assigned(DLLFunc) then DLLFunc('dddddddddddddddddddd', 2, s); finally {unload a library} FreeLibrary(DLLHandle); end; end; 问题是Assigned(DLLFunc) 失败,我的接口声明type TDLLFunc = function (const ss: PChar; i: integer; var param2: string): boolean; 有问题吗? 请不吝赐教
------
wxs |
syntax
尊榮會員 發表:26 回覆:1139 積分:1258 註冊:2002-04-23 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |