I want to call a function from a .NET DLL (coded in C#) from an Inno Setup script.
I have:
-
marked the Register for COM interop option in the project properties,
-
changed the
ComVisiblesetting in theAssemblyInfo.csfile, -
added these lines to the ISS script:
[Files] Source: c:\temp\1\MyDLL.dll; Flags: dontcopy[Code] function MyFunction(): string; external 'MyFunction@files:MyDLL.dll stdcall setuponly';
But I still get the following error:
Runtime Error (at -1:0):
Cannot Import dll:C:\DOCUME~1\foo\LOCALS~1\Temp\is-LRL3E.tmp\MyDLL.dll.
What am I doing wrong?
Oops, my bad, it’s been too long since I’ve read pascal! So, if you need to get the value then there are a couple of possibilities:
When I last worked with InnoSetup it didn’t support your scenario directly (calling .NET code from setup).