Delphi DLL区分大小写

Delphi DLL区分大小写,delphi,dll,Delphi,Dll,我正在用delphi XE8编写一个dll,供用delphi XE8编写的应用程序使用 我的DLL看起来像这样 function GetInt : Integer; stdcall; begin Result := 300; end; exports GetInt; dllHandle := LoadLibrary(PChar('myDLL.dll')); ShowMessage(SysErrorMessage(GetLastError)); if dllHan

我正在用delphi XE8编写一个dll,供用delphi XE8编写的应用程序使用

我的DLL看起来像这样

  function GetInt : Integer; stdcall;
  begin
    Result := 300;
  end;
  exports GetInt;
dllHandle := LoadLibrary(PChar('myDLL.dll'));
  ShowMessage(SysErrorMessage(GetLastError));
  if dllHandle <> 0 then
  begin
    @GetInt := GetProcAddress(dllHandle, 'GetInt');
    ShowMessage(SysErrorMessage(GetLastError));
    if Assigned(GetInt) then
      ShowMessage(IntToStr(GetInt))
    else
      ShowMessage('Nope');
    end;
我的应用程序看起来像这样

  function GetInt : Integer; stdcall;
  begin
    Result := 300;
  end;
  exports GetInt;
dllHandle := LoadLibrary(PChar('myDLL.dll'));
  ShowMessage(SysErrorMessage(GetLastError));
  if dllHandle <> 0 then
  begin
    @GetInt := GetProcAddress(dllHandle, 'GetInt');
    ShowMessage(SysErrorMessage(GetLastError));
    if Assigned(GetInt) then
      ShowMessage(IntToStr(GetInt))
    else
      ShowMessage('Nope');
    end;
dllHandle:=LoadLibrary(PChar('myDLL.dll');
ShowMessage(SysErrorMessage(GetLastError));
如果dllHandle为0,则
开始
@GetInt:=GetProcAddress(dllHandle,'GetInt');
ShowMessage(SysErrorMessage(GetLastError));
如果已分配(GetInt),则
ShowMessage(IntToStr(GetInt))
其他的
ShowMessage('Nope');
结束;
我得到一个“找不到指定的过程”错误。因此,我将exports语句和@GetInt语句从“GetInt”更改为“GetInt”。现在一切都很好


所以现在我的问题是:为什么我的dll函数和导出需要是同一个单词,区分大小写不同

Windows DLL导出的符号名称区分大小写。您提供的代码与您描述的不符。您的实际代码有不匹配的字母大小写


几乎可以肯定,您正在加载一个过时的DLL

GetProcAddress
确实区分大小写。您的代码看起来是正确的。我建议您检查图像的导出目录(例如,
tdump
)不能用呈现的代码复制。这从来不是一个好迹象。我使用的是Delphi XE8.Right。当我的库具有该函数且与我的应用程序匹配的导出无法获得该函数时。当我故意添加大小写不匹配时,我的应用程序加载的函数(我更改应用程序以反映dll exports语句)不是真的。你的报告不正确。我想您正在加载一个过期的DLL。谢谢!这就是正在发生的事情。