【问题标题】:C++ .NET DLL wrapper to a C# COM DLL (built with Mono)C++ .NET DLL 包装器到 C# COM DLL(使用 Mono 构建)
【发布时间】:2012-10-01 20:31:25
【问题描述】:

我有一个 C# COM DLL 的 C++ .NET COM DLL 包装器,我很好奇,是否可以在 UNIX 上使用 Mono 构建包装器?当我尝试时,我得到了很多这样的错误:

$>/opt/mono/bin/mcs /target:library *.cpp -recurse:'*.cpp' -warn:0 -out:my.dll -r:System.Windows.Forms.dll -r:System.Data.dll -r:System.Xml.Linq.dll

/AssemblyInfo.cpp(2,18): error CS1024: Wrong preprocessor directive
/AssemblyInfo.cpp(4,6):  error CS1041: Identifier expected, `namespace' is a keyword
/AssemblyInfo.cpp(4,22): error CS1001: Unexpected symbol `;', expecting identifier
/AssemblyInfo.cpp(42,1): error CS8025: Parsing error

我还是 COM 和 Mono 的新手,所以如果这个想法存在根本缺陷,我深表歉意。

附言。如果有兴趣,我可以包含实际代码,但我对一般机制更好奇。

【问题讨论】:

  • Mono 是 C# 编译器,而不是 C++ 编译器,这就是它在尝试编译 C++ 代码时产生错误的原因。
  • @dmakaitis 谢谢!我想我已经假设它完成了所有 .NET 而不仅仅是 C#。 =)

标签: c# c++ unix dll mono


【解决方案1】:

COM 组件不是跨平台的,它只适用于 Windows 操作系统,等效的跨平台替代方案是 Firefox 使用的 XPCOM

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-24
    • 2011-01-08
    • 1970-01-01
    • 2011-07-27
    • 1970-01-01
    • 1970-01-01
    • 2011-12-29
    相关资源
    最近更新 更多