Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Learning CIL [closed]

Tags:

.net

cil

Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good.

like image 674
ljs Avatar asked Sep 04 '08 23:09

ljs


3 Answers

The only CIL book on my shelf is Expert .NET 2.0 IL Assembler by Serge Lidin. In terms of what the individual opcodes do or mean, the Microsoft documentation on System.Reflection.Emit has some pretty good information. And it's always useful to look at existing IL with Reflector.

Edit: CIL (and indeed the CLR in general) has not changed at all between .NET 2.0 and .NET 3.5 -- the underlying runtime is basically the same, modulo fixes and performance improvements. So there's nothing newer available on a CIL level than what would be in a book on 2.0

like image 158
Curt Hagenlocher Avatar answered Nov 03 '22 01:11

Curt Hagenlocher


Expert .NET 2.0 IL Assembler rocks because the author writes well and includes every freaking detail you can imagine. It doesn't hurt that he wrote the IL assembler, disassembler and validator. Best of all you can buy it in a PDF instead of a dead tree.

Masochists interested in compiler development will also enjoy Compiling for the .NET Common Language Runtime by John Gough. I found this book immensely helpful during a virtual machine development project where I "stole" lots of ideas from the CLR design.

like image 31
Vern Eastley Avatar answered Nov 03 '22 02:11

Vern Eastley


Expert .NET 2.0 IL Assembler by Serge Lidin

There was a 1.1 version of the same book, but I haven't seen anything for the latest .NET release. It's an excellent book. I used it to write an OCR component in MSIL, as a learning project.

[Edit] @Curt is right, 3.0 and 3.5 are just extensions to 2.0, I hadn't plugged that in to my head yet. Now I've thought of a fun geek project... compare the disassembly of standard 2.0 code to the new LINQ/Lambda way of performing common tasks like filtering lists. For some reason I assumed that the magic was happening in new IL features, not just the compiler.

like image 41
Eric Z Beard Avatar answered Nov 03 '22 00:11

Eric Z Beard