CCI Documentation

Topics: Metadata Model, PDB Reader, PDB Writer, PE reader, PE Writer, Source Model
Dec 14, 2009 at 5:01 PM

FYI, I've been asked to create some documentation for CCI Metadata. First step is to reorganize the current content a bit. I'll try to get through that stage quickly to limit the disruption. Longer term, I'll be adding conceptual documentation, sample walkthroughs and what have you to the Documentation page, which is currently unused. I'm hoping to get that work started later this week.

Feedback is welcome. In addition to doc bugs, I'd like to know what additional topics you would like to see.

Guy Smith

Dec 21, 2009 at 6:24 PM

Thank you! It sounds like you are just learning the API yourself - who are the primary developer(s)?

I would like to see

  • A class diagram showing important relationships between the classes. Right now I am wondering what the relationship is between the source object model, the metadata object model, and the code model (that AST thing).
  • A detailed diagram or explanation of the PE format itself (both its physical structure and conceptual structure) or a link to such a thing if someone else has already made it.
  • A series of examples with an explanation of classes, methods and concepts used in each example, for each of CCI's common use cases.
    - For a compiler writer, it would be useful to see a well-documented demo showing how to create an assembly that contains several of the things that a compiler would need to create: a class, an interface, a property, a field (with an initializer), a static field, a method, an [attribute] attached to one of the above, and how to construct CIL instructions that reference fields and methods in (i) the same class, (ii) a class in the same assembly, (iii) a class in an external assembly. And, how to create a source model of the same.
    - For the code analysis use case, a useful demo might be a "size profiler" program that enumerates the classes and functions of an assembly and identifies their physical size in bytes in the assembly, to help a user find bloated code.
    - For an assembly rewrite demo, how about a "profiler" that injects code into each nontrivial method, to count the number of times it was called (you can see I'm in sore need of profilers....)

Also, I would like help choosing whether to use Mono.Cecil or CCI for my compiler project.