Starting a CLR Program


An executable CLR program contains at least three components :

  • The user -defined assembly with an entry point

  • The execution system, found in either mscorsvr.dll or mscorwks.dll

  • The basic type system, found in mscorlib.dll

Whenever a CLR program starts, the runtime environment must start, too. One of the first instructions within any CLR executable achieves this task by calling either _CorExeMain or _CorDllMain , both of which are found in mscoree.dll . As its name suggests, mscoree.dll is the initial part of the execution engine. If an executable serves as a program's entry point, then _CorExeMain is called; if it does not, then _CorDllMain is called. Naturally, mscoree.dll is an unmanaged executable, as it needs to interact with a number of low-level system APIs.

The code in mscoree.dll decides which version of the runtime environment to load. This environment is housed in a file named mscorsvr.dll (the version for servers) or mscorwks.dll (the version for workstations). Multiprocessor server machines normally have the server version loaded; all other configurations activate the workstation version.

An executing CLR program also needs access to the types defined in other assemblies. Because all CLR programs need access to the definition of System.Object , mscorlib.dll is loaded as well.



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net