Created Thursday 23 January 2014
Build Process
Java and C# have a similar build processes.
In Java:
- code JAVA file
- compiler turns JAVA file into CLASS file containing byte code. CLASS files are OS independent.
- JVM interprets CLASS file to platform-specific OS calls. JVMs are OS dependent.
- JIT (just-in-time compilation) happens as the CLASS file is interpreted. JVMs don't turn byte code into native code unless it uses a JIT. Originally, not every JVM used a JIT but nowadays most JVMs use JITs.
In C#:
- code C# file (usually with CS extension)
- compiler turns CS file into intermediate language (IL). IL code and resources is stored in a file called managed assembly (EXE or DLL).
- .NET framework (via common language runtime or CLR) turns assembly into native code using a JIT. Code run by CLR is also called managed code. Alternatively, you can use the ngen tool to compile C# directly into native code.
- Language interoperability is a key feature. C#-generated IL code works with IL code generated by .NET VB, Visual C++, and +20 other languages.
Common Language Runtime
The common language runtime (CLR) is the heart of .NET Framework and provides the execution environment for all .NET Framework code. The CLR provides various functions and services required for program execution, including just-in-time (JIT) compilation, allocating and managing memory, enforcing type safety, exception handling, thread management, and security.
The CLR is a virtual machine. The CLR has a set of low-level operations it can perform, a set of memory services, and an assembly language to define executable programs (the intermediate language or IL).
Resources
- http://www.coderanch.com/t/394556/java/java/Java-Interpreter-Compiler
- Compiled vs Interpreted
- Intro to C# and .NET Framework
- Create Language Compiler for .NET
No backlinks to this page. comments powered by Disqus