动态调用bpl,如何调用bpl中的procedure和function

                            象dll样输出 我已试成功了,而且是在mdi中试成功的。
贴出代码,大家同喜。希望bbkxjy来拿分。
主要的原因是bpl输出的目录默认为\bpl下。
而我一直没有在意。
bpl部分;
...
type
  TUIPackageForm = class(TForm)
    DataSource1: TDataSource;
    DBNavigator1: TDBNavigator;
    DBGrid1: TDBGrid;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  procedure ShowMDIChildForm(MainApp:TApplication);stdcall;
  exports
     ShowMDIChildForm;
var
  UIPackageForm: TUIPackageForm;
implementation
{$R *.DFM}
procedure ShowMDIChildForm(MainApp:TApplication);stdcall;
begin
  Application:=MainApp;
  UIPackageForm:=TUIPackageForm.Create(MainApp);
  UIPackageForm.Show;
end;
procedure TUIPackageForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action := cafree;
end;
动态调用的主程序部分。
type
  Tshowmdiform=procedure(MainApp:TApplication);stdcall;

  showmdiform:Tshowmdiform;
begin
  UIConnect := LoadPackage('bpl');
  showmdiform:=getprocaddress(UIConnect,'ShowMDIChildForm');
  if (@showmdiform<>nil) then
      showmdiform(application)
    else showmessage('no prc');
end;

                                

查看回复