如果调用程序和dll都带包编译,出现此错误如何只有一方或者都不带包编译,没有此错误而实际需求需要带包编译?源码如下:
dll:
library wz_lld;uses
  ShareMem,
  windows,
  SysUtils,
  forms,
  Db,
  DBTables,
  unt_wz_lld in 'unt_wz_lld.pas' {Frm_wz_lld},
  unt_wz_lld_pnt in 'unt_wz_lld_pnt.pas' {Frm_wz_lld_pnt},
  unt_function in '..\unt_function.pas';function ShowChild(App:TApplication;
          DbUser:ShortString;DbPassword:ShortString;BdeAls:ShortString;
          ASsdw:ShortString;AUserId:ShortString;Abhdwdm,Abh:shortstring
          ;AScrollBox:TScrollBox):integer;stdcall;
begin
  ssdw := ASsdw;
  userid := AUserId;
  lldh := Abh;
  llddwdm:=Abhdwdm;
  Application:=App;
  Application.Handle := app.Handle;
  if not assigned(frm_wz_lld) then
    frm_wz_lld := TFrm_wz_lld.Create(Application);
  with Frm_wz_lld do
  begin
 {   BorderStyle := bsNone;
    BorderIcons := [];
  //  align := alClient;
  //  WindowState:=wsMaximized;
    Windows.SetParent(Handle, AScrollBox.Handle);
    windows.MoveWindow(Handle, 0, 0, AScrollBox.Width,AScrollBox.Height, True); }
    show;
  end;
  Result:= Frm_wz_lld.Handle;
//  Result:=(TFrm_wz_lld.Create(Application)).handle;
end;
{Function: Set Dll-Application Var back to originall Value}procedure SetOldApplication;stdcall;
begin
  Application:=OldApp;
end;{$R *.RES}
exports ShowChild,SetOldApplication;
begin
  {Save original Applicatioin Variable}
  OldApp:=Application;
end.调用程序:(部分)
  TF_ShowChild = function (App:TApplication;
          DbUser:ShortString;DbPassword:ShortString;BdeAls:ShortString;
          ASsdw:ShortString;AUserId:ShortString;Abhdwdm,Abh:shortstring
          ;AScrollBox:TScrollBox):integer;stdcall;function TFrm_wz_lldcl.getDisposalDLLName: string;
begin
  result := 'wz_lld.dll';
end;procedure TFrm_wz_lldcl.LoadDLL(DLLName: string);
var
  LastError:DWord;
begin
  if dllModHandle_= 0 then
  begin
    dllModHandle_:=loadLibrary(pchar(DLLName));
    if dllModHandle_ =0 then
    begin
      LastError := GetLastError;
      Raise EDLLLoadError.create(IntToStr(LastError) + ': DLL不存在');
    end;
    ShowChild:=getProcAddress(dllModHandle_,'ShowChild');
    if @showChild=Nil then begin
      Raise EDLLLoadError.create(IntToStr(LastError) + ': 不能够找到函数 ShowChild');
    end;
    SetOldApplication:=getProcAddress(dllModHandle_,'SetOldApplication');
    if @SetOldApplication=Nil then begin
      Raise EDLLLoadError.create(IntToStr(LastError) + ': 不能够找到函数 SetOldApplication');
    end;
  end;
end;procedure TFrm_wz_lldcl.sptnDisposalClick(Sender: TObject);
var
  DLLName:string;
  i:integer;
begin
  if stgGrid.Cells[1,stgGrid.Row] = '' then exit;
  ScrollBox1.BringToFront;
  ScrollBox1.Align := alClient;
  Pnl_main.SendToBack;
  DLLName := getDisposalDLLName;
  LoadDLL(DLLName);
  i:=ShowChild(Application,'','','dBAlias_ND',
        ssdw,Userid,stgGrid.cells[1,stgGrid.Row],stgGrid.cells[2,stgGrid.Row],ScrollBox1);
end;procedure TFrm_wz_lldcl.FormDestroy(Sender: TObject);
begin
  arrField := nil;  if dllModHandle_<>0 then
  begin
    SetOldApplication;
    FreeLiBrary(dllModHandle_);
  end;
end;