Can I have managed code within native code?
Can I have开发者_如何学C managed code within native code?
There are quite a few ways to do this.
You can code in C++/CLI, the managed C++ compiler provided by Microsoft. You can mix managed and native code as you wish (security restrictions may apply).
You can go the COM route, and it's natively supported on the .NET side. Harder to program on the native side though, especially all the interop. You can start here: http://msdn.microsoft.com/en-us/magazine/cc163494.aspx.
The 3rd way is to "host" the .net runtime engine directly into your app and use it to load managed assemblies and then execute parts from them. This may be overkill for you, but it generates a 100% native image and doesn't rely on COM interop. You can start here: http://msdn.microsoft.com/en-us/library/dd380850.aspx.
精彩评论