O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a Custom Host for the Common Language Runtime

The first thing that needs to happen when writing a custom CLR host is to load and initialize the CLR. This happens through a small piece of code that takes a version and other startup information and starts the CLR. This code is known as a “shim” and it is implemented in a file called mscoree.dll. On startup, a process will get a pointer to an interface in this shim and through that interface initialize and start the CLR.

To get an interface to this shim, call CorBindToRuntimeEx. Listing C.1 shows how to make a call to this function. The complete source that is associated with this listing and the following code snippets are available in the CustomCLR directory for this Appendix.

Listing C.1. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required