Dependency Walker -- A remedy for distribution headaches

From assela Pathirana
Jump to: navigation, search

If you have ever tried to give away a reasonably complicated program that was written and compiled on windows to another user you should be very familiar with complaints of missing DLLs, and other dependencies and module mismatches etc., etc. These erros can manifest themselves in many forms (The procedure entry point could not be located in the dynamic link library; The application or DLL is not a valid Windows image or even Program too big to fit in memory.) This is particularly so if you happen to be developing with a complex build environment that is tightly integrated with windows system, like visual studio (I often use Visual C++ 2005/2008 express (free) editions and they create a lot of trouble in deployment!)

Sometimes it is possible to solve these issues by trial and error: Try running the program in a new computer and try including the needed DLL files (remember: Some DLL files are not freely distributable due to licensing restrictions, so check carefully) that the program complains missing, one by one. But, for a fairly complex program this can sometimes be quite tiring path to follow. The Dependency Walker is a program that can help making the figuring out of dependencies, a fairly smooth and fast task.

Dependency Walker

Dependencies of a program

Simply put, Dependency Walker is a utility that scans any windows application (or any other module like a DLL) and builds a list of all dependent modules. It recursively scans each of the dependent modules in tern to see their dependencies. For example when I opened one of the programs written in C++ and compiled using visual C++ 2008 express edition with dependency walker, it showed the dependencies shown on the figure in right.

The application depends on MSVCP90.DLL, MSVCR90.DLL, KERNEL32.DLL and NTDLL.DLL to run. A brief Googling session will show that MSVCP90.DLL and MSVCR90.DLL are files specific to visual C++ 2008 express edition that needs to be in the deployed platform. So, a possible approach is to include them with the application program (they are distributable according to Microsoft(R)). On the other hand KERNEL32.DLL and NTDLL.DLL are very central system files that are present in every windows installation (in this form or an equivalent form) and no need to copy (In fact they must not be copied casually from computer to computer!! Moreover they are protected by copyrights.)

The bottom line is if we copy E2M.exe with MSVCP90.DLL and MSVCR90.DLL to another machine the program has every chance of running equally successfully as the original machine it was made. But, this is not the end of the story.


Profiling (often known as Performance analysis is the analysis of a program at runtime. The ultimate dependency test for a program is profiling. It is possible to do profiling with Dependency Walker and the process might provide dependencies that are not apparent from static analysis (i.e. above procedure).