Developing a large application in native C++ and want to extend this app so they can mold it to their needs. Allowing to write the extensions in managed code inside the Microsoft® .NET Framework would make their development experiences much smoother than if they had to work with native code.
For applications that were written by using the .NET Framework, hosting the common language runtime is completely transparent. If you compile your managed code as an .exe assembly, the runtime is started automatically by mscoree.dll when the .exe is run. However, unmanaged applications can also benefit from hosting the common language runtime. Whether it is invoked automatically, as with managed .exe assemblies, or loaded by using the unmanaged hosting API, a .NET Framework application requires a piece of code called a runtime host. The runtime host loads the runtime into a process, creates application domains within the process, and loads and executes user code within those application domains.
Selecting CLR Version From Unmanaged Host:
Question: What is the correct way determine what framework version is installed on a computer to choose the correct CLR hosting approach(I would like my code to work in CLR 2.0+ environment) ?
Answer:
- LoadLibrary mscoree
- GetProcAddress for CLRCreateInstance. If you get NULL, fall back to legacy path (CorBindToRuntimeEx)
- Call CLRCreateInstance to get ICLRMetaHost. If you get E_NOTIMPL, fall back to legacy path (same as above)
- Otherwise, bank on the ICLRMetaHost you just got
ref:
CLR Hosting API - http://msdn.microsoft.com/en-us/magazine/cc163567.aspx
Hosting the Common Language Runtime - http://msdn.microsoft.com/en-us/library/9x0wh2z3(v=vs.90).aspx
CLR 4.0: In Process Side-by-Side CLR Hosting - http://geekswithblogs.net/sdorman/archive/2008/11/10/clr-4.0-in-process-side-by-side-clr-hosting.aspx
Hosting CLR in native application - http://www.lenholgate.com/blog/2010/07/clr-hosting---a-flexible-managed-plugin-system-part-1.html
Selecting CLR Version From Unmanaged Host - http://bradwilson.typepad.com/blog/2010/04/selecting-clr-version-from-unmanaged-host.html
Scheduling & Threading - http://community.bartdesmet.net/blogs/bart/archive/2005/07/26/3094.aspx
App Domain Shallow Copy - http://community.bartdesmet.net/blogs/bart/archive/2006/07/29/4146.aspx