Summary
This book describes the many ways the CLR can be customized to
Now that I've defined some basic terms and discussed the typical architecture of an extensible application, let's get started with a broad overview of what you can achieve by customizing the CLR using the hosting APIs. |
Chapter 2. A Tour of the CLR Hosting API
The common language runtime (CLR) hosting API is a set of unmanaged functions and interfaces that a host uses to customize the CLR for its particular application model. Because the CLR has been designed to adapt to a variety of application scenarios, the amount of customization available through the hosting APIs is quite
Most of the individual features introduced here have entire chapters dedicated to them later in the book. This chapter merely provides the big picture. In addition to explaining the features, I'll describe the design pattern used in the interfaces and provide enough background and samples to get you started using them. The hosting API is defined in the file mscoree.idl, which can be found in the Include directory in the Microsoft .NET Framework software development kit (SDK). These programming interfaces consist of both unmanaged functions and a set of COM interfaces. The unmanaged functions are public exports from mscoree.dll. Most of these functions are used primarily for CLR initialization, but some are used to discover basic information about the CLR after it is running, such as which version was loaded and where the CLR installation resides on disk. |
CorBindToRuntimeEx and ICLRRuntimeHostThe primary unmanaged function you'll use is CorBindToRuntimeEx . This function is used to initialize the CLR into a process and is therefore the first of the hosting APIs you're likely to call. One of the return parameters from CorBindToRuntimeEx is a pointer to an interface named ICLRRuntimeHost the initial COM interface in the hosting API. I say " initial " because ICLRRuntimeHost is the first interface you'll use when hosting the CLR. Given an interface pointer of type ICLRRuntimeHost , you gain access to all the other hosting functionality provided by the API. Figure 2-1 provides a sampling of the breadth of functionality a CLR host can access given a pointer to the ICLRRuntimeHost interface. Figure 2-1. The CLR hosting interfaces as the gateway to the managed environment
Because of its role as the initial interface that
Table 2-1. The Methods on ICLRRuntimeHost
|