我在 win7 和 delphi 2010 上工作。这是我的代码。
library CFGFunc;
uses
sysUtils
Un_ExFuncDll in "base\Un_ExFuncDll.pas"
...
exports
LoadExFuncsInDLL,
...
Un_ExFuncDll.pas 在这里
unit Un_ExFuncDll;
interface
uses
Classes;
procedure LoadexfuncsIndll(); stdcall;
...
编译后,dll 不工作。但是我将 LoadexfuncsIndll()
替换为
LoadExFuncsInDLL()
(与导出中的内容完全匹配)在 Un_ExFuncDll.pas
中。然后它起作用了。
Delphi 不区分大小写。但似乎 dll 中的导出是区分大小写。 那么,他们有什么关系呢?
最佳答案
导入/导出 DLL 函数是区分大小写,而且一直都是。该行为与区分大小写的 OS DLL 加载程序相关联。这是 Delphi 语言中仅有的区分大小写的区域之一。这是记录在案的行为,至少部分是:
Writing Dynamically Loaded Libraries
A name specifier consists of the directive name followed by a string constant. If an entry has no name specifier, the routine is exported under its original declared name, with the same spelling and case. Use a name clause when you want to export a routine under a different name.
Procedures and Functions (Delphi)
In your importing declaration, be sure to match the exact spelling and case of the routine's name. Later, when you call the imported routine, the name is case-insensitive.
关于windows - dll 中的导出是否区分大小写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20206750/