HelloIL Sample Walkthrough

CCI Metadata

HelloIL is a Common Compiler Infrastructure (CCI) Metadata application that creates an assembly for a simple console application, Hello.exe, from scratch. Typically, CCI Metadata applications start with an existing assembly. However, this sample is a convenient way to introduce the basics of how to use the CCI Metadata API.

For details on how to obtain the HelloIL sample, see How to Compile and Run HelloIL.

HelloIL uses the CCI Metadata API to create the assembly that would be produced by compiling the following C# code.
public class Test
{
  main()
  {
    Console.WriteLine(“Hello”);
  }
}

HelloIL follows the programming pattern that is described in the following set of topics. This general programming pattern can be adapted to a variety of more sophisticated applications.

Create a Host
Create and Configure an Assembly Object
Add Type Metadata to the Assembly
Add Method Metadata to the Types
Add Code to the Method Bodies
Write the Assembly to a File

Note: As you follow this walkthrough, notice that HelloIL explicitly sets numerous properties. CCI generally does not provide default values for properties. If a property should be set, you must do so explicitly.

Next: Create a Host

Last edited Dec 18, 2009 at 8:48 PM by Guy_Smith, version 1

Comments

No comments yet.