CHAPTER 14 BUILDING AND CONFIGURING CLASS LIBRARIES
...
Now, remember that the vast majority of .NET programmers will never need to concern themselves
with the format of the header data embedded in a .NET assembly. Unless you happen to be building a
new .NET language compiler (where you would care about such information), you are free to remain
blissfully unaware of the grimy details of the header data. Do be aware, however, that this information is
used under the covers when Windows loads the binary image into memory.
The CLR File Header
The CLR header is a block of data that all .NET assemblies must support (and do support, courtesy of the
C# compiler) in order to be hosted by the CLR. In a nutshell, this header defines numerous flags that
enable the runtime to understand the layout of the managed file. For example, flags exist that identify
the location of the metadata and resources within the file, the version of the runtime the assembly was
built against, the value of the (optional) public key, and so forth. If you supply the /clrheader flag to
dumpbin.exe like so:
dumpbin /clrheader CarLibrary.dll
you are presented with the internal CLR header information for a given .NET assembly, as shown here:
Dump of file CarLibrary.dll
File Type: DLL
clr Header:
48
2.05
2164
1
0
0
0
0
0
0
0
cb
runtime version
[
A74] RVA [size]
flags
IL Only
entry point token
[
0] RVA [size]
[
0] RVA [size]
[
0] RVA [size]
[
0] RVA [size]
[
0] RVA [size]
[
0] RVA [size]
of MetaData Directory
of
of
of
of
of
of
Resources Directory
StrongNameSignature Directory
CodeManagerTable Directory
VTableFixups Directory
ExportAddressTableJumps Directory
ManagedNativeHeader Directory
Summary
2000 .reloc
2000 .rsrc
2000 .text
Again, as a .NET developer, you will not need to concern yourself with the gory details of an
assembly’s CLR header information. Just understand that every .NET assembly contains this data, which
is used behind the scenes by the .NET runtime as the image data loads into memory. Now let’s turn our
attention to some information that is much more useful in our day-to-day programming tasks.
513