Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Dependency Walker

📅 2010-Jul-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

The Dependency Walker is a great utility to figure out DLL problems. Here is a simple illustration of its use.

I was recently working on code shared by a friend. The C++ code compiled fine under Visual Studio 2010, but when executed would pop up this error message:

 

The error message:

The program can't start because MSVCR80.dll is missing from your computer. Try reinstalling the program to fix this problem.

I dissected MSVCR80.dll as MS (Microsoft) VCR (Visual C Runtime) 80 (Visual Studio 2005) library.

The age old Windows trick of getting MSVCR80.dll from some other computer and putting it in the directory of the .exe did not work. This is because Windows now ships with a SxS system to maintain DLLs of various versions. This requires manifest files and other complicated machinery to work.

Installing the Windows 7 Platform SDK, the older Windows Server 2003 Platform SDK and Visual C++ 2005 Redistributable packages did not work either.

Having no further clue to this problem, I decided to use Dependency Walker. Execute the depends.exe and open the .exe which is throwing the error.

Dependency Walker immediately found the 3 DLLs which were causing problems. These are displayed in red in the middle pane:

 

To figure out the origin of the use of these DLLs, right-click on any of the problematic DLL in the middle pane and choose Highlight matching module in tree. This shows the origin of the problem in the dependency tree displayed in the top pane:

 

Bingo! So, a third party DLL named ILMIMF.dll that was linked with the C++ code was the cause of the error. Rebuilding this DLL separately from its source code and relinking the rest of the project fixed the error.