libray datashow;
uses
 windows,messages,....//窗体定义,实现,输出其实例化的过程!
//数据模块实现,初始化,
procedure dllmain(reason:integer);
begin
 case reason of
  dllattach:
   begin
    //窗体初始化,实例化,重要
    //数据模块初始化
   end;
 ...
 
end;exports
  //list of your procs  & func must interact with your calling program.begin
//..... 
end.
一言难尽。

解决方案 »

  1.   

    我是这样的,我在初始化时是这样的:
    library Kdll;
    uses
      SysUtils,
      Classes,
      ViewObj in 'ViewObj.pas' {FrmShow},
      DataObj in 'DataObj.pas' {ObjData: TDataModule};{$R *.RES}
    procedure ShowData();
    begin
      ObjData:=TObjData.Create(nil); //ObjData是数据模块变量名称,
      FrmShow:=TFrmShow.Create(nil); //FrmShow是窗体变量名称
      try
        FrmShow.ShowModal;
      finally
        FrmShow.Free;
        ObjData.Free;
      end;
    end;exports
        ShowData;
    beginend.
    使用起来时出现EOleSysError,说是尚未调用CoInitialize,究竟是怎么一回事呢,说实话,
    我在数据库方面还可以,但对Dll却是菜鸟一只,请各位老鸟热心指教。