Analyzing dependencies with Dependency Walker

Last edited on

Overview

The Dependency Walker (also see alternative download links at the bottom of this page) tool can help to analyze the dependencies in Windows applications — this can be useful for solving dependency-related problems.

It can also reveal which compiler (and sometimes even which compiler version) has been used to compile an application. See Detecting the compiler .

A application can specify some or all of its dependencies inside its .exe file in a standard way. When loading the application in Dependency Walker, the list of dependencies shown is based on this static information.

In addition, applications can also load further resources at runtime, which means that it isn't possible to know all of the application's dependencies without executing it. Fortunately, the Dependency Walker tool also supports analyzing such runtime dependencies.

Static analysis

After starting Dependency Walker it looks like this:

Now you can choose File > Open... to open a .exe file for analysis; or you could simply drag and drop an .exe file (e.g., from the desktop or from Windows Explorer) onto the Dependency Walker's application window.

Here is the Dependency Walker after dropping the Squish addressbook example's addressbook.exe onto it:

As you can see it lists the dependency and sub-dependencies.

To get a better overview over the immediate dependencies of just the executable, you can collapse nodes if you wish:

It can be useful to view the full paths of the dependencies to make sure that the executable is using the correct .dlls (i.e., to check that it isn't reading old .dlls that are in the PATH). To enable this, right click on any of the nodes and choose Full Paths in the context menu:

Here is the same view with full paths:

You can save the result of the dependency analysis into a file, for example to send to someone else to inspect.

For this choose File > Save as...:

In the resulting dialog be sure to choose the *.dwi format since this will ensure that the resulting file can be opened by someone else running Dependency Walker on another computer:

Missing imports/imported symbols

The information about missing imports is available in the "Parent Import Function List View":

💡 Note the light red icon next to the .dll with the missing imports.

Since it can be very time consuming to scroll through this possibly very large list to find the missing imports you can use a trick that might make it easier:

...
     [ E ] QTGUI4.DLL

          Import  Ordinal         Hint            Function                                                                                                                                                                                                                                                                                                                                                                                                                                                                Entry Point
          ------  --------------  --------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------
          [+  ]              N/A   3091 (0x0C13)  void QAbstractButton::animateClick(int)                                                                                                                                                                                                                                                                                                                                                                                                                                 Not Bound
          ...
Now search for "\[+E" to locate the failed imports (they are prefixed with "\[+E"):
...
     [ E ] QTGUI4.DLL

          Import  Ordinal         Hint            Function                                                                                                                                                                                                                                                                                                                                                                                                                                                                Entry Point
          ------  --------------  --------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------
          [+  ]              N/A   3091 (0x0C13)  void QAbstractButton::animateClick(int)                                                                                                                                                                                                                                                                                                                                                                                                                                 Not Bound
          ...
          [+  ]              N/A   9662 (0x25BE)  void QAbstractTextDocumentLayout::resizeInlineObject(class QTextInlineObject,int,class QTextFormat const &)                                                                                                                                                                                                                                                                                                                                                             Not Bound
          [+E ]              N/A   3622 (0x0E26)  void QAccessible::cleanup(void)                                                                                                                                                                                                                                                                                                                                                                                                                                         Not Bound
          [+E ]              N/A   6463 (0x193F)  void QAccessible::initialize(void)                                                                                                                                                                                                                                                                                                                                                                                                                                      Not Bound
          [+E ]              N/A   6651 (0x19FB)  void QAccessible::installFactory(class QAccessibleInterface * (*)(class QString const &,class QObject *))                                                                                                                                                                                                                                                                                                                                                               Not Bound
          [+E ]              N/A   6652 (0x19FC)  void (*QAccessible::installRootObjectHandler(void (*)(class QObject *)))(class QObject *)                                                                                                                                                                                                                                                                                                                                                                               Not Bound
          [+E ]              N/A   6654 (0x19FE)  void (*QAccessible::installUpdateHandler(void (*)(class QObject *,int,enum QAccessible::Event)))(class QObject *,int,enum QAccessible::Event)                                                                                                                                                                                                                                                                                                                           Not Bound
          [+E ]              N/A   6741 (0x1A55)  bool QAccessible::isActive(void)                                                                                                                                                                                                                                                                                                                                                                                                                                        Not Bound
          ...

In the above example, QAccessible-related symbols are missing — in this case this is because the version of Qt being used by the application has been built without the Accessibility module.

Runtime analysis / Profiling

For a runtime analysis do the following:

More information about profiling with Dependency Walker can be found here:

Using Application Profiling to Detect Dynamic Dependencies

Start Profiling Command (Profile Menu)

Profile Module Dialog

Detecting the compiler

The immediate DLL dependencies of the executable file can tell us which compiler (and sometimes which compiler version) has been used to compile an application:

Dependent DLLCompilerVersion
MINGWM10.DLLMinGWn/a
MSVCRT.DLLMSVC6MSVC6, Visual C++/Studio 6
MSVCRT7.DLLMSVC7MSVC9, Visual Studio 2008
MSVCR8.DLLMSVC8MSVC8, Visual Studio 2005
MSVCR9.DLLMSVC9MSVC9, Visual Studio 2008
MSVCRT10.DLLMSVC10MSVC10, Visual Studio 2010

Finding information in Dependency Walker

Various information can be found after loading a file in Dependency Walker :

For a Debug build of a Qt application a Debug build of the Squish for Qt package is required. (Please request Debug build packages of Squish for Qt from our technical support.)