我写了一个DLL,其DLL中有一个Procdeure,我为什么能静态调用此DLL,而不能动态调用呢?
动态调用:
Type
TBOMExport = Procedure (H:THandle;ItName:Pchar;BoMTree:TTreeView);StdCall;  EDllLoadError = Class(Exception);....
// 调用部份LibHandle:=LoadLibrary('ProBomTree.DLL');
   Try
      If LibHandle = 0 then
         Raise EDLLLoadError.Create('不能加载DLL');
      @BOMExpand:=GetProcAddress(LibHandle,'BOMExpand');
      if Not(@BOMExpand=nil) Then
      Begin
         BOMExpand(Application.Handle,Pchar(TItem.Text),BoMTree);
      End
      Else
        RaiseLastWin32Error;
    Finally
       FreeLibrary(LibHandle);
   End;

解决方案 »

  1.   

    你看看你的dll,是否将BOMExpand露出来了,名字没错吧。
      

  2.   

    TO 楼上兄弟:
              我将BOMExpand露出来了,但还是一样啊,,我在DLL中EXPORT 的名字是BOMExpand啊
      

  3.   

    BOMExpand是什么类形将改为Pointer
    这样写试试
    BOMExpand:=GetProcAddress(LibHandle,'BOMExpand');
      if Not(BOMExpand=nil) Then//这里柯
          Begin
                   TbomExport(BOMExpand)(Application.Handle,Pchar(TItem.Text),BoMTree);
          End
          Else
              ShowMessage('ERROR');