I know that this question has answer, but he does not help me. I saw articles: link and link, but I have problem. My code:
C#:
[DllExport("ServerOfDataBases", CallingConvention = CallingConvention.StdCall)]
public static int ServerOfDataBases(
string server, string user, string password,
[MarshalAs(UnmanagedType.BStr)] out string strout)
{
string resultStr = String.Empty;
// ...
strout = resultStr;
return 0;
}
Inno Setup:
[Files]
Source: "GetDataBases.dll"; Flags: dontcopy
[Code]
function ServerOfDataBases(server, user, password: string; out strout: WideString): Integer;
external 'ServerOfDataBases@files:GetDataBases.dll stdcall';
I get this error
Cannot Import dll:C:\Users...\AppData\Local\Temp\is-ECJ5V.tmp\GetDataBases.dll
Thank you for any idea.
Works for me, if I follow all the instructions from my answer to:
Calling .NET DLL in Inno Setup
So I would guess, that you didn't set the Platform target of your .NET/C# project to x86.
For more about returning strings from DLL, see:
Returning a string from a C# DLL with Unmanaged Exports to Inno Setup script