如果不是动太加载,可以这样写:
  procedure AProcdure; stdcall; external 'ADll.dll' index 22;
如果用 GetProcAddress,如何取这类函数指针?

解决方案 »

  1.   

    如果该导出的API函数的名字是你说的这样的“怪名字”~~~那么说明一个问题,他不是以cdecl方式导出的。~~~~~你将stdcall改成别的试试
      

  2.   

    const
      cFileNameLibrary = 'ADll.dll';procedure TForm1.Button2Click(Sender: TObject);
    type
      TProcedure = procedure; stdcall;
    var
      vHandle: THandle;
    begin
      vHandle := LoadLibrary(cFileNameLibrary);
      try
        TProcedure(GetProcAddress(vHandle, PChar(22)));
      finally
        FreeLibrary(vHandle);
      end;
    end;
    //---------------------------------------------------
    The GetProcAddress function returns the address of the specified exported dynamic-link library (DLL) function. FARPROC GetProcAddress(    HMODULE hModule, // handle to DLL module  
        LPCSTR lpProcName  // name of function 
       );
     ParametershModuleIdentifies the DLL module that contains the function. The LoadLibrary or GetModuleHandle function returns this handle. lpProcNamePoints to a null-terminated string containing the function name, or specifies the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.  it must be in the low-order word; the high-order word must be zero. 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~