Glossary
IL = Intermediate Language, in. net is designed to become the Common Intermediate Language, and because the Council itself is universal, Microsoft designed an implementation for him. On the Microsoft platform, we can also call it MSIL.
Target
It provides a specific implementation for the underlying design of the. Net platform, the features of the basic programming language, such as process control, Judgment, arithmetic computing, and address. There are also specific object-oriented designs, relationships between classes, hiding, inheritance, interfaces, and so on. More support for functional languages, understanding IL is not only a deep understanding of the program, but also an important basis for the Framework of. Net Framework. I personally think
Basic knowledge
Every. Net application or assembly is actually a PE (Portable Execution) file. Details about the PE file format and so on will be described later.
Instance-starting from HelloWrold
Code:
1: .assembly extern mscorlib {}
2: .assembly hello {}
3: .method static public void main() cil managed
4: {
5: .entrypoint
6: .maxstack 1
7: ldstr "Hello world!"
8: call void [mscorlib]System.Console::WriteLine(class System.String)
9: ret
10: }
1. mscorlib is located in % Windows %/Microsoft. NET/Framework/v2.0.50727. It is the basis for the interaction between. Net programs and APIs, and contains the implementation of the basic class library (BCL ).
2. Set the Assembly name to hello.
3 ....
5. entrypoint entry point
6. Allocate stacks
7. load string
8. Call Method
9. Return
I have been learning about IL for a long time and have recently explored it. net Design and other things. I started to look at IL for a while. I was busy with my work. Instead, I put it on hold. I didn't write this thing for anything, but I just urged myself.
Reference books:
Expert. NET 2.0 IL Explorer
Common Language Infrastructure Partition II