Understanding errors in classical linking: The delay-load catch-22

Wrapping up our week of understanding the classical model for linking, we’ll put together all the little pieces we’ve learned this week to puzzle out a linker problem: The delay-load catch-22. You do some code cleanup, then rebuild your project, and you get LNK4199: /DELAYLOAD:SHLWAPI ignored; no imports found from SHLWAPI What does this error…

25

Understanding the classical model for linking: You can override an LIB with another LIB, and a LIB with an OBJ, but you can't override an OBJ

If you study the classical model for linking, you’ll see that OBJ files provided directly to the linker have a special property: They are added to the module even if nobody requests a symbol from them. OBJs bundled into a library are pulled into the module only if they are needed to resolve a needed…

27

Understanding the classical model for linking: Taking symbols along for the ride

Last time, we learned the basics of the classical model for linking. Today, we’ll look at the historical background for that model, and how the model is exploited by libraries. In the classical model, compilers and assemblers consume source code and spit out an OBJ file. They do as much as they can, but eventually…

15

Understanding the classical model for linking, groundwork: The algorithm

The classical model for linking goes like this: Each OBJ file contains two lists of symbols. Provided symbols: These are symbols the OBJ contains definitions for. Needed symbols: These are symbols the OBJ would like the definitions for. (The official terms for these are exported and imported, but I will use provided and needed to…

23