Scenarios and samples

The CLR PE file reader provides a fast and memory efficient way to read in metadata incrementally from CLR PE files. This is an ideal way for compilers written in managed code to import metadata. It involves no unmanaged code and no interop overhead.

Likewise, the CLR PE file writer provides a fast and memory efficient way to write out metadata into a stream provided by the caller. Unlike APIs such as System.Reflection.Emit, the PE writer does not require a compiler to construct objects using factory methods and constructors provided by the writer API. The writer will write out any object model that implements the metadata model interfaces. It too, involves no unmanaged code, but if a PDB file is wanted, it will interact with the PDB file writer, which at the moment is a managed wrapper for an unmanaged COM component.

A common scenario is to read in a PE file, make some modification to it and then write it out again. The PeToPe sample provides a starting point for this kind of application.

Perhaps the most common scenario is to write a language agnostic error checking tool, such as the static checker in Code contracts tool.

Last edited Apr 8, 2009 at 10:42 PM by hermanv, version 2

Comments

No comments yet.