Subject DLL questions
Author Rolf Bredemeier
Dear list,


i have an DLL to show a form for searching data. It works fine, but i am not
shure, ob everything is ok. Specially the call ASearchObj.Free in my exported
function may be not O.K? (Once again, everything seems to work..)

Perhaps, someone has nerves of steel to read the following code! ;-)

Best regards, Rolf

------------TArtikelSuche--------------------------------------------------
TArtikelSuche = class(TObject)
private
frm_obj_suchfenster: Tfrm_obj_suchfenster; // TForm
FConnection: TIB_Connection;
FTransaction: TIB_Transaction;
FSearchQuery: TIB_Query;
procedure suchKnopfKlick(Sender: TObject);
procedure ListViewSelectItem(Sender: TObject;Item: TListItem; Selected: Boolean);

protected
public
constructor Create(adbhandle:pointer);
destructor Destroy; override;
function sucheArtikelRetID:Integer;
function sucheArtikelRetARTNR:string;
published
end;

constructor TArtikelSuche.Create(adbhandle: pointer);
begin
fconnection:= TIB_Connection.Create(nil);
fconnection.dbhandleshared:= adbhandle;
ftransaction:= TIB_Transaction.Create(nil);
FTransaction.Isolation:= tiCommitted;
FTransaction.AutoCommit:= true;
FTransaction.IB_Connection:= FConnection;

//Query vorbereiten f�r SuchProcedure
FSearchQuery:= TIB_Query.Create(nil);
FSearchQuery.IB_Connection := FConnection;
FSearchQuery.IB_Transaction := FTransaction;

end;

destructor TArtikelSuche.Destroy;
begin
FSearchQuery.Close;
FSearchQuery.Free;
FTransaction.Free;
fconnection.Free;
inherited;
end;
-------End TArtikelSuche--------------------------------------------------


This is the exported function of my DLL.
******************************************
function sucheArtikelRetARTNR(dbhandle: Pointer):shortstring;
var
hilf: ShortString;
ASearchObj: TArtikelSuche;
begin
ASearchObj := TArtikelSuche.Create(dbhandle);
hilf := ASearchObj.sucheArtikelRetARTNR;
Result := ShortString(hilf);
ASearchObj.Free;
end;
******************************************