如何在C ++中使用C#dll? [英] How to use C# dll in C++?
问题描述
myDLL.dll已生成来自IKVM。在C#项目中使用非常好。
如何:
< br style ="color:#333333; font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size:13px; background-color:#fafafa">
1。在C ++中调用静态方法。在C#代码中,它是`com.myApp.Initialiser.initialise(object,string,int)`
2。在C ++中创建一个新实例。在C#代码中它是`new com.myApp.requests.MyRequest()`
< blockquote>两种通用方法 - 1)通过COM将C#方法暴露给非托管C ++ 2)使用中间C ++ / CLI dll来提供非托管C ++和C#程序集之间的粘合。 在
互联网上有很多关于此的文章,一个例子是
从非托管C / C ++代码调用C#.NET方法
myDLL.dll was generated from IKVM. Use in C# project is perfectly fine.
HOW to:
1. call a static method in C++. in C# code, it is `com.myApp.Initialiser.initialise(object, string, int)`
2. create a new instance in C++. in C# code it is `new com.myApp.requests.MyRequest()`
Two general approaches - 1) expose the C# methods to unmanaged C++ through COM and 2) use an intermediate C++/CLI dll to provide the glue between unmanaged C++ and the C# assembly. There are many articles about this on the internet, one example is at Calling C# .NET methods from unmanaged C/C++ code
这篇关于如何在C ++中使用C#dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!