Is there a possibility to use a .NET assembly in a non-CLR-Program?
I'm developing a plugin for 3DsMax. So it is开发者_JAVA百科 non-CLR C++. My question is, whether there is a possibility to use a .NET assembly within this plugin?
Thank you for your answers
Regards Nem.
Yes, however you will need to host the CLR within your application.
This is how IIS hosts ASP.NET websites, and how SQLServer allows for CLR functions etc.
Take a look at the CLR hosting API here: http://msdn.microsoft.com/en-us/magazine/cc163567.aspx
You can certainly do it through COM-interop.
You can attribute a .NET assembly as exposing a COM interface, which can then be accessed by any native process that can use COM services.
Bottom line is that if you want to use a .Net assembly, then you will need the CLR to run it. There are a variety of ways to accomplish this in a native process including
- Hosting the CLR within the otherwise native process
- Running the assembly in a separate .Net process and communicating via COM interop
精彩评论