打印本文 打印本文 关闭窗口 关闭窗口
非COM环境下的接口编程--问题,技巧,应用(二)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1745  更新时间:2009/4/23 18:35:04  文章录入:mintao  责任编辑:mintao
  begin

   FList[i].Free;

   FList[i]:=nil;

  end;

  Finalize(Flist);

  inherited;

end;

 

function TFooManager.GetFooByID(id: integer): IFoo;

begin

 result:=FList[id] as IFoo;

end;

 

function TFooManager.GetFooNum: integer;

begin

 result:=FooNum;

end;

 

Dll中仅有的两个导出函数:

function GetFooManIntf:IFooManager;stdcall;

begin

 if not assigned(FooMan) then

 begin

  FooMan:=TFooManager.Create;

 end;

 result:=FooMan as IFooManager;

end;

 

procedure FreeLib;stdcall;

//释放工厂类

begin

 if assigned(FooMan) then

 begin

  FooMan.Free;

  FooMan:=nil;

 end;

end;

上一页  [1] [2] [3] 

打印本文 打印本文 关闭窗口 关闭窗口