System Programming

Win32 LD_PRELOAD
System Programming
Published: 2014-12-20
Win32 LD_PRELOAD

Many versions of UNIX have a useful concept built in to their dynamic linker: by setting an environment variable (usually LD_PRELOAD), a user can force a shared library to load before all others. While I wasn’t able to figure out how to exactly replicate this functionality on Windows, I found a snippit on page 794 of Programming Applications for Microsoft Windows: Fourth Edition, by Jeffrey Richter, on how to come close. On this page, Mr. Richter explains a way to force an executable to load a dynamic library before it begins executing code. While this is only one of several ways he suggests to achieve this goal, I was drawn to this one because it seemed the most flexible.