Free mag vol1 | Page 29

 CONTENTS  Chapter 18: Understanding CIL and the Role of Dynamic Assemblies................651 Reasons for Learning the Grammar of CIL.....................................................................651 Examining CIL Directives, Attributes, and Opcodes.......................................................652 The Role of CIL Directives..................................................................................................................... 653 The Role of CIL Attributes ..................................................................................................................... 653 The Role of CIL Opcodes....................................................................................................................... 653 The CIL Opcode/CIL Mnemonic Distinction........................................................................................... 653 Pushing and Popping: The Stack-Based Nature of CIL ..................................................654 Understanding Round-Trip Engineering.........................................................................656 The Role of CIL Code Labels ................................................................................................................. 659 Interacting with CIL: Modifying an *.il File............................................................................................ 660 Compiling CIL Code Using ilasm.exe .................................................................................................... 661 The Role of peverify.exe ....................................................................................................................... 662 Understanding CIL Directives and Attributes .................................................................663 Specifying Externally Referenced Assemblies in CIL............................................................................ 663 Defining the Current Assembly in CIL ................................................................................................... 663 Defining Namespaces in CIL................................................................................................................. 664 Defining Class Types in CIL .................................................................................................................. 665 Defining and Implementing Interfaces in CIL........................................................................................ 666 Defining Structures in CIL..................................................................................................................... 667 Defining Enums in CIL........................................................................................................................... 667 Defining Ge nerics in CIL ....................................................................................................................... 668 Compiling the CILTypes.il file ............................................................................................................... 668 .NET Base Class Library, C#, and CIL Data Type Mappings ...........................................669 Defining Type Members in CIL.......................................................................................670 Defining Field Data in CIL ..................................................................................................................... 670 Defining Type Constructors in CIL ........................................................................................................ 671 Defining Properties in CIL ..................................................................................................................... 671 xxvii