library A9Proc;{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }uses
  ShareMem,
  Windows, Messages, SysUtils, Classes, ComCtrls, Forms, ComObj, DB, DBGridEh, Graphics,
  ADODB, Variants, FR_Class, FR_Desgn, FR_DBSet, strutils, Controls, RzButton, Math,
  StdCtrls, Menus, TB2Item, printers, TB2Dock, DBGrids, TB2Toolbar, Dialogs, ExtCtrls,
  DBHjLib, DBLookupEh, DateUtils;{$R *.res}procedure OpenFRM(FormClass: TFormClass; fm, AOwner: TComponent);
//打开Mdi窗口通用函数
var
  i: integer;
  Child: TForm;
begin
  for i := 0 to Screen.FormCount - 1 do
    if Screen.Forms[i].ClassType = FormClass then
    begin
      Child := Screen.Forms[i];
      if Child.WindowState = wsMinimized then
        ShowWindow(Child.handle, SW_SHOWNORMAL)
      else
        ShowWindow(Child.handle, SW_SHOWNA);
      if (not Child.Visible) then
        Child.Visible := True;
      Child.BringToFront;
      Child.Setfocus;
      TForm(fm) := Child;
      exit;
    end;
  Child := TForm(FormClass.NewInstance);
  TForm(fm) := Child;
  Child.Create(AOwner);
end;procedure OpenMDI(Sender: TFormClass);
var
  i: Integer;
  Frm: TForm;
begin
  for i := 0 to  application.MainForm.MDIChildCount - 1 do begin
    if application.MainForm.MDIChildren[i].ClassType = Sender then begin
      Frm := application.MainForm.MDIChildren[i];
      if Frm.WindowState = wsMinimized then //為最小化
        ShowWindow(Frm.handle, SW_SHOWNORMAL)
      else
        ShowWindow(Frm.handle, SW_SHOWNA);
      if (not Frm.Visible) then Frm.Visible := True;
      Frm.BringToFront;
      Frm.SetFocus;
      Exit;
    end;
  end;
  Frm := TForm(Sender.NewInstance);
  Frm := Frm.Create(nil);
  Frm.Show;
end;exports
  OpenFRM,
  OpenMDI;
beginend.
以上是我做的dll,调用时有错误,
但是如果写成函数在pas里面调用的话,不会错
请大家帮我看看!!!