且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从C ++调用C#方法而不使用COM

更新时间:2023-12-04 15:42:55

如果你使用C ++ / CLI,那么你可以直接与被管理的世界和非托管代码交互,所以interop是微不足道的。

If you are using C++/CLI then you can interact directly with both the managed world and unmanaged code, so interop is trivial.

您也可以自己托管CLR,而托管API是基于COM的,您可以创建任何托管对象。这个过程并不困难,因为它听起来像几个API调用封装了很多功能。有很多在线信息,例如MSDN文档托管公共语言运行库

You can also host the CLR yourself, and whilst the hosting API is COM based, you can then create any managed object. The process isn't a difficult as it sounds as a few API calls encapsulate a lot of functionality. There is a lot of info online, for example the MSDN documentation on "Hosting the Common Language Runtime".