Managed Execution Process


According to the ".NET Framework Developer's Guide," the managed execution process includes the following steps:

1.

Choose a compiler To obtain the benefits provided by the CLR, you must use one or more language compilers that target the runtime, such as Visual Basic, C#, Visual C++, or JScript.

2.

Compile your code to Microsoft Intermediate Language (MSIL) Compiling translates your source code into MSIL and generates the required metadata. This is the only part of the execution process that the build team really cares about.

3.

Compile MSIL to native code At execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During this compilation, code must pass a verification process that examines the MSIL and metadata to find out whether the code can be determined to be type safe.

4.

Execute your code The CLR provides the infrastructure that enables execution to take place, besides a variety of services that can be used during execution.

Figure 10.1 depicts this .NET compilation process in graphical form.

Figure 10.1. .NET compilation process.


The .NET applications are developed with a high-level language, such as C# or VB.NET. The next step is to compile this code into MSIL. MSIL is a full-fledged, object-aware language, and it's possible (but unlikely an analogy might be to write an application in an assembly language) to build applications using nothing but MSIL. The JIT Compiler (aka jitter) occurs at the assembly level. JIT compilation takes into account the fact that some code might never be called during execution. Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls. Sometimes people confuse JIT compiling for "building," but it is only the bold text in Figure 10.1 that the build team really cares about.

This JIT compiling is what makes .NET rather unique and sometimes confusing when compared to unmanaged code builds. In the old world of building you would just compile and link everything into an executable binary and then ship the binary or binaries. In the .NET or Web services world, you ship "assemblies" that need to be JIT compiled or "assembled" by the .NET Framework.

Note that the compilers for the .NET languages are included free with the .NET Framework. In addition, the C++ compiler is now free. Also notice that there is no concept of "linking" in .NET. Instead, code gets linked dynamically in the "runtime" platform that .NET provides.



The Build Master(c) Microsoft's Software Configuration Management Best Practices
The Build Master: Microsofts Software Configuration Management Best Practices
ISBN: 0321332059
EAN: 2147483647
Year: 2006
Pages: 186

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