Inno Setup版本5.6.1(u)。
Dev Studio 2015 64位类库。
.NET Framework 4.6.1
使用UnamanagedExports包。
这是脚本:
[Setup]
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
[Files]
Source: "DotNet64.dll"; Flags: dontcopy
[Code]
function TestFunction(): Boolean;
external 'Testing@files:DotNet64.dll stdcall setuponly delayload';
procedure CurPageChanged(CurPageID: Integer);
var
ires : Boolean;
begin
if CurPageID = wpWelcome then begin
ires := TestFunction();
end;
end;
这是C#DLL代码
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace DotNet64
{
public class InnSetDLL
{
[DllExport("Testing", CallingConvention = CallingConvention.StdCall)]
public static bool Testing()
{
return false;
}
}
}
在脚本中调用TestFunction()
后,我会弹出一个窗口:
运行时错误(在2:55处):无法调用proc。
答案 0 :(得分:2)
DotNet64.dll是否编译为64位DLL?根据{{3}},InnoSetup无法访问64位DLL。您可以将其编译为32位DLL,也可以编写一个64位EXE来调用您的64位DLL并执行64位EXE。