Inno Setup version 5.6.1(u).
Dev Studio 2015 64 bit class library.
.NET Framework 4.6.1
Uses the UnamanagedExports package.
Here's the script:
[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;
Here's the C# DLL code
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;
}
}
}
As soon TestFunction()
is called in the script, I get a popup:
Runtime Error (at 2:55): Could not call proc.
Is the DotNet64.dll compiled as a 64 bit DLL? InnoSetup can't access 64 bit DLLs as per the documentation. You can compile it as a 32 bit DLL or write a 64 bit EXE that calls your 64 bit DLL and execute the 64 bit EXE.