關於dll問題 |
尚未結案
|
lesliewong
一般會員 發表:3 回覆:3 積分:1 註冊:2002-05-16 發送簡訊給我 |
library func; uses
SysUtils, Classes, ADODb; function GetProdName(aDB: TADOConnection; aProdNo: string): string; export;
var
q : TADOQuery;
begin
Result := '';
q := TADOQuery.Create(nil);
try
q.Connection := aDB;
with q do
begin
Close;
SQL.Clear;
SQL.Add('select product, chdescrip1 from product');
SQL.Add('where product = :product');
ParamByName('product').Value := aProdNo;
Open;
if not eof then Result := FieldByName('chdescript').AsString;
end;
finally
q.Free;
end;
end; {$R *.res} exports
GetSystemCompanyName; begin
end. ********************************************** function GetProdName(aDB: TADOConnection; aProdNo: string): string; external 'c:\func.dll'; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
begin
edit2.Text := GetProdName(ADOConnection1, edit1.Text);
end; end. 使用不到dll, 反而出error??
|
alphakao
一般會員 發表:0 回覆:18 積分:8 註冊:2002-07-04 發送簡訊給我 |
有幾個問題
1.
export table 中的 Function Name 跟你寫在 DLL 中的 Function Name 不一致
GetSystemCompanyName vs GetProdName (你的 DLL 還沒 Load 到就 Error 可能是這個問題)
2
在 DLL 中的 Function 傳遞不確定長度的參數 好像應該 把 sharemem 加到
uses 中的第一行,雖然你沒有在 DLL 中變動這個參數,可是還是有風險 發表人 - alphakao 於 2004/08/06 13:54:18
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |