CIL: Difference between revisions

Jump to navigation Jump to search
526 bytes added ,  16 years ago
+ unmanaged code
[unchecked revision][unchecked revision]
(first attempt)
 
(+ unmanaged code)
Line 3:
The '''Common Intermediate Language''' ('''CIL''', formerly '''MSIL''') is a byte code intermediate language used in the [[.NET Framework]]. It is 'managed code' created by any [[CLI]] compatible compiler (such as the [[C Sharp|C# Compiler]], and executed by the [[Virtual Execution System]] (VES). It is CPU and platform independent.
 
Most of the time, developers will not be programming directly in CIL but use a higher level language such as [[C Sharp|C#]], [[C++/CLI]], [[Visual Basic .NET]] and [[J#]]. However, CIL has it's own assembly language which can be assembled by ILAsm (<code>ilasm.exe</code>). To display the byte code in assembly language, the CIL disassembler ILDAsm (<code>ildasm.exe</code>) is used. However, some specialized tools such as .NetNET Reflector can represent the byte code as any of the supported higher level languages, such as C#, including the classes, methods and other metadata.
 
==Managed and unmanaged code==
The CIL byte code is so called managed code, which means that the execution system knows where all the data is, all the time. Therefore it is not possible to use pointers in managed code. Thanks to this property, the most common security and stability problems are eliminated, such as buffer overflows and dangling pointers. A [[garbage collector]] is employed to use the memory as efficient as possible.
 
===Unsafe code===
Although pointers are not possible in managed code, CIL supports unmanaged code which does have support for pointers. Unmanaged code is contained in blocks of code which is marked 'unsafe', and in C# it uses the same syntax as C and C++. Objects can be _pinned_ so that the [[garbage collector]] doesn't move the data around and pointers remain valid. Using unsafe code is perfectly legal, although discouraged in normal application programming, and may be used to write kernel-level methods.
 
==Metadata==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu