我知道这个问题有答案,但他没有帮助我。我看过文章:link和link,但我有问题。我的代码:
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设置:
[Files]
Source: "GetDataBases.dll"; Flags: dontcopy
[Code]
function ServerOfDataBases(server, user, password: string; out strout: WideString): Integer;
external 'ServerOfDataBases@files:GetDataBases.dll stdcall';
我收到此错误
无法导入dll:C:\ Users ... \ AppData \ Local \ Temp \ is-ECJ5V.tmp \ GetDataBases.dll
谢谢你的任何想法。
答案 0 :(得分:0)
如果我按照我的回答中的所有指示操作,对我有用:
Calling .NET DLL in Inno Setup
所以我猜,你没有将.NET / C#项目的平台目标设置为 x86 。