编写Dll时
library DllExample;
uses
  SysUtils,
  Classes,
  Dialogs,
  Example in 'Example.pas';{$R *.res}
procedure showHello; export
begin
  ShowMessage('Hello World');
end;exports
  showHello index 1;begin
end.
----------------------------
unit Example;interface
  procedure showHello;implementation
  procedure showHello; external 'DllExample' index 1;end.
编译时有警告错误
[Warning]DllExample.dpr(28): Symbol 'INDEX' is specific to a platform
[Warning]Example.pas(9): Symbol 'INDEX' is ...在调用这个Dll时,程序报错说找不到Dll
我也Use了Example单元,Dll也在同一目录
还会是什么问题呢?

解决方案 »

  1.   

    你是调用的DLL吧,难道你编译后的DLL叫‘DllExample’吗?应该是DllExample.dll吧
      

  2.   

    在写Dll的导出函数的时候,除了Windows内置的三个核心Dll不需要写出完整的名称。其余Dll需要写出完整的名字包括后缀名。另:最好不要用Index来导出函数,最好用函数名称。
      

  3.   

    同意,不要用index,快一点不值行.以后改动时很麻烦
      

  4.   

    在dll中:
    1)uses语句中包含ShareMem单元,要将ShareMem单元放在第一个
    2)procedure showHello;stdcall