Updated: 1/22/2004; 8:07:02 PM.
ronpih I guess...
Your guess is as good as mine...
        

Saturday, December 21, 2002

The Microsoft Linker

One of the items on my new team's plate is the linker so I'm getting to know this tool.  In the past I haven't really thought much about the linker.  When I'm writing code I usually don't have to worry too much about the linker beyond the occasional LNK2001 (unresolved external) error message when I forget to add a library that's needed to the linker switches.  I guess I'm a pretty pedestrian developer...

Now that I'm digging into it, though, it's clear that the linker is a very important tool.  Its main function is to gather all the individual intermediate files that contain bits that need to be combined into an executable file and build the executable file (quite a job, as it turns out...).  But, as I'm finding about, it does a more:

  • It assembles the debug information for the generated executable if requested.
  • It invokes the C++ compiler back end to generate code when you use whole program optimization.
  • It Inovkes the MIDL compiler for attributed code that uses MIDL attributes.
  • It's the back end for a number of other tools (dumpbin, editbin, lib).
  • It Implements the delay loading mechanism (the ability to have your executable not load implicitly linked DLLs until code in the DLL is called at runtime).
  • It can create a map file that shows the offsets in the executable module where the code and data that make up the module are located.
  • It can calculate a checksum when requested and embeds it into the executable image (usually only for device drivers).
  • It allows the setting of various attributes on the executable module (version numbers, heap sizes, stack size, etc.).
  • Probably some other stuff I don't know about yet.

When you think about it, the linker is really the glue between a lot of disparate things (compilers, the operating system, debuggers) and is really the one tool that has a complete view of all the pieces that come together to make executable files build and run.  Pretty important.

But, when I look on Amazon, I only find one book on linkers.  I guess there's a couple of reasons for that:

  • Most people only care about the linker when it fails.
  • It's pretty specific to the OS's and compilers that it works with.

Be that as it may, I'll be delving into the MS Linker on this page in future posts.  For those of you who don't care about esoteric aspects of this tool, you have been warned... 8^)


12:51:52 PM    comment []

© Copyright 2004 Ronald Pihlgren.
 
December 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Nov   Jan

Weblogs
Microsoft Testers
VC++ Bloggers
Links
Note:This is a personal weblog. All opinions expressed here are mine alone.


Click here to visit the Radio UserLand website.

Subscribe to "ronpih I guess..." in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.