The CLR provides an unmanaged set of functions and COM interfaces called the CLR hosting API. An application that uses the CLR hosting API are called CLR hosts. CLR Hosting is about hosting the CLR in your native process and interacting with it to optimize the CLR. Examples of applications that also are CLR hosts: SQL Server 2005, Internet Explorer, ASP.NET et.al.
CLR host applications are typically loading code dynamically. The code loaded are also usually sandboxed into a separate application domain.
Add-Ins are extensions to your application. Where they come from is not important. They are dynamically added to your application at run-time, and they typically run under their own security context as each application domain can have its own security context and isolation boundary.
The hosting API is defined in mscoree.idl found in the Microsoft .NET Software Development Kit.
Among the things you can adjust with the CLR hosting API:
- Assembly Loading
The host can adjust various aspects of the CLR assembly loading process.
- CLR Events
The host can receive various events from the CLR such as application domain unloading etc.
- Garbage Collection
The host can force a collection and get statistics about recent collections. The host can also receive events on when collection begins and ends.
The host can adjust how the CLR allocates memory.
The host can give a custom implementation of the Thread Pool the CLR uses.
The host can provide synchronization primitives for the CLR to use.
- I/O Completion
The host can provide a custom implementation of overlapped input/output (I/O)