Analyzing dependencies with Dependency Walker

Skip to end of metadata
Go to start of metadata

Table Of Contents

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:

Please note that Dependency Walker may show a dialog at start up. This can typically be ignored, so just close the dialog and proceed.

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:

  • Save the information with Save As... in the file format "Text with Import/Export Lists (*.txt)":

  • Open the file that you just saved in a text editor (since this file can become relatively large be sure to open it with a suitable text editor like Notepad++ or similar).
  • Search for the name of the .dll with the light red icon (QtGui4.dll in this example). The second occurrence of this should be the list of imports from this .dll:
     ...
     [ 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:

  • Load the desired .exe file into Dependency Walker.
  • Choose Profile > Start Profiling....

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

How To Use Dependency Walker Version 2.1 to Create a Profile
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 DLL Compiler Version
MINGWM10.DLL MinGW n/a
MSVCRT.DLL MSVC6 MSVC6, Visual C++/Studio 6
MSVCRT7.DLL MSVC7 MSVC9, Visual Studio 2008
MSVCR8.DLL MSVC8 MSVC8, Visual Studio 2005
MSVCR9.DLL MSVC9 MSVC9, Visual Studio 2008
MSVCRT10.DLL MSVC10 MSVC10, Visual Studio 2010

Finding information in Dependency Walker

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

  • #1 - Runtime libraries of the compiler: Provides compiler version (MSVC6, MSVC7, MSVC8, MSVC9, MSVC10, etc.).
  • #1 - Build type: Release or Debug build; the latter is indicated by "d" appended to the file names of the Qt DLLs (QT5CORED.DLL, or similar) as well as the Visual C++ Runtime DLLs (MSVCP90D.DLL, or similar).

    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.)
  • #2 - Exported symbols: If for example QObject::setName(...) is listed (after selecting QtCore4.dll) the Qt library was configured with enabled Qt3Support module.
  • #3 - Word size: x86 indicates 32 bit and x64 indicates 64 bit.
  • #4 - File version: Version of Qt in case of a Qt library.

Related Information

depends22_x64.zip (Alternative download from our web site in case of errors on original web site.)

depends22_x86.zip (Alternative download from our web site in case of errors on original web site.)

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.