繁体   English   中英

在 Inno Setup 中导入 C# DLL 时“无法导入 dll”

[英]“Cannot Import dll” when importing C# DLL in Inno Setup

我知道这个问题有答案,但他不帮我。 我看到了文章: linklink ,但我有问题。 我的代码:

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; 
}

创新设置:

[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

谢谢你的任何想法。

对我有用,如果我按照我的回答中的所有说明进行操作:
在 Inno Setup 中调用 .NET DLL

所以我猜,您没有将 .NET/C# 项目的Platform 目标设置为x86


有关从 DLL 返回字符串的更多信息,请参阅:
使用非托管导出从 C# DLL 返回字符串到 Inno Setup 脚本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM