What is the equivalent of Linux's ldd
on Windows?
-
1see also https://stackoverflow.com/questions/7378959/how-to-check-for-dll-dependency – sercxjo Sep 26 '21 at 08:33
10 Answers
The dumpbin
command can be useful for many things, although in this case dependency walker is probably a little more verbose.
dumpbin /dependents some.dll
Example output:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools>dumpbin /dependents StanPolicy.dll
Dump of file StanPolicy.dll
File Type: DLL
Image has the following dependencies:
mscoree.dll
Summary
2000 .reloc 2000 .rsrc 1E000 .text

- 2,761
- 1
- 27
- 31

- 813
- 6
- 9
Here is Dependency Walker.

- 187,200
- 47
- 362
- 445
-
12does anything like ldd exist, for command line only? Looking for something I can use from a prompt. Prefer a small light command, preferably without extra DLLs. – J. M. Becker Oct 17 '11 at 14:49
-
2It appears that that has a command line interface: http://www.dependencywalker.com/help/html/hidr_command_line_help.htm – Daniel A. White Oct 17 '11 at 14:54
-
3Syntax looks something like this: depends.exe /c /oc:dependencies.csv /ot:dependencies.txt mydll.dll – Boinst May 21 '13 at 05:13
-
3Dependency Walker works well, but is a jarring change from the simplicity of ldd (especially if you're used to scripting a tool consume its output and do, say, packaging tasks automatically with it). – zxq9 Jun 27 '15 at 07:53
-
4
or the GNU tool :
i586-mingw32msvc-objdump -p *.exe | grep 'DLL Name:'
-
1Can objdump be used to display the full path? I need something recursively and this requires fullpath for each dependant DLL – INS Jan 24 '13 at 08:26
-
4objdump only shows you what the file contains. It does not attempt to do any path lookup like `ldd` does. – jørgensen Jul 17 '14 at 12:35
If you're using wine
and not real Windows, you can use WINEDEBUG=+loaddll wine <program>
.

- 20,267
- 14
- 135
- 196
-
7Developing against Wine to target Windows struck me as so strange an idea I had to give it a try (I primarily target Linux)... and actually it is working out *far* smoother than I expected for prototyping. Very, very cool. – zxq9 Jun 27 '15 at 07:49
-
Re: development using Wine instead of Windows: note that what works in Wine won't necessarily work on real Windows. I learned this when I forgot to call `GdiplusStartup`, and GDI+ worked without problems in Wine, while on Windows it didn't. I only noticed this mistake after having debugged the program in Wine, trying next to run it in Windows. – Ruslan Jun 03 '17 at 19:29
-
I test things on Wine all the time, just to avoid restarting and changing OS. However, it's good practice before a major release--or any time you've done something that feels even a little suspicious--to try it out on Windows native as well. – Michael Macha Nov 20 '20 at 13:45
Newer versions of Git on Windows come packaged with something called Git BASH, which emulates many useful Unix commands including ldd.
It appears that it reports only libraries that can be found. So you can use this to get an overview of where the used libraries are located, but not which are missing.

- 1,656
- 2
- 16
- 28
There is now an ldd
in Cygwin. If you have a very old Cygwin version, you will have to use cygcheck
.

- 20,267
- 14
- 135
- 196
-
2
-
Still not very accurate in 2023 - when I run it over and over again on an MSYS2/UCRT executable developed for a customer (that doesn't change at all...), I'll usually get something between 35 and 40 DLLs listed. Every now and then I even get the correct 41 dependencies. – Andrew Henle Jan 30 '23 at 19:52
I guess the Windows Developer way to do this is to use dumpbin /dependents source.exe
. If you have Visual Studio installed you can find it here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\dumpbin.exe
.

- 9,873
- 10
- 45
- 59
-
3Too bad this doesn't show where the dependents are found so you can precisely see which ones are actually used at runtime :(. – rubenvb Jul 30 '17 at 12:12
-
@rubenvb Process Explorer from SysInternals MS suite has lower-pane view of all DLLs a binary loads including their paths and symbol/dll search. – Kevin Mar 05 '20 at 21:34
For Windows 10 you can use Dependencies - An open-source modern Dependency Walker

- 101
- 1
- 2
For windows 10, with visual studio 2017, I go in the search bar of windows and type:
"developer Command Prompt for VS 2017" ( a special cmd.exe for Visual studio developer)
This allows to get access to DUMPBIN that should be used with the /IMPORTS tag. For example, in the correct directory:
DUMPBIN /IMPORTS yourfile.exe (others extension may work too)
For me, this list the DLL and the functions used.
Alternatively, you can use the tag \ALL that is much more verbose.
see the microsoft explanation of DUMPBIN:
https://learn.microsoft.com/en-us/cpp/build/reference/imports-dumpbin?view=vs-2019
Example ( with only a part) of the content sended back by the command

- 4,452
- 10
- 23
- 47

- 129
- 1
- 5
-
the complete example like : `dumpbin /imports *.dll | find /i ".dll"` – Mohammad Kanan Jan 06 '21 at 19:59
-
-
This answer could be a comment to the prior answers, just noting that some users might prefer to sue the developer command prompt. – sage Aug 06 '21 at 16:59
On Windows I use the cmder as terminal for most things (and not powershell/pwsh). For cmder you can simply type "ldd my_executable.exe" and you will see the expected output.
Link to download cmder: https://cmder.net/

- 21
- 3