I'm trying to call a C# function from Inno Setup, however I'm getting the error
Internal error: extracttemporyfile the file "ClassLibrary1.dll" was not found`
I have placed the .dll file in the same folder as the inno setup script and even tried adding the .dll to the [files]
section like this
[Files]
Source: "ClassLibrary1.dll"; Flags: dontcopy
However I still get the same error as above.
Here in my C# code including the namespace (this is just to test if the function can be called)
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
using System;
namespace ClassLibrary1
{
public class ActivationClass
{
[DllExport("Activation", CallingConvention.StdCall)]
public static Boolean Activation([MarshalAs(UnmanagedType.BStr)] string input)
{
if (input == "1a2b3c")
{
return true;
}
return false;
}
}
}
Here is the Inno Setup Script
[Code]
function Activation(key: WideString): Boolean;
external 'Activation@files:ClassLibrary1.dll stdcall';
function InitializeSetup(): Boolean;
var status: Boolean;
begin
status := Activation('1a2b3c');
case status of
true: msgbox('true', mbInformation, MB_OK);
false: msgbox('false',mbInformation, MB_OK);
end;
Result := status;
end;