Delphi DLL案例敏感性

时间:2016-05-06 21:07:41

标签: 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 dllHandle <> 0 then
  begin
    @GetInt := GetProcAddress(dllHandle, 'GetInt');
    ShowMessage(SysErrorMessage(GetLastError));
    if Assigned(GetInt) then
      ShowMessage(IntToStr(GetInt))
    else
      ShowMessage('Nope');
    end;

我得到了一个&#34;找不到指定程序&#34;错误。所以我从&#34; G etInt&#34;更改了我的exports语句和@GetInt语句。到&#34; g etInt&#34;。现在一切都很好。

所以现在我的问题是:为什么我的dll功能和导出需要是具有不同区分大小写的同一个单词?

1 个答案:

答案 0 :(得分:2)

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

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

相关问题