How to check for DLL dependency?
Sometimes when I'm doing a little project I'm not careful enough and accidentally add a dependency for a DLL that I am not aware of. When I ship this program to a friend or other people, "it doesn't work" because "some DLL" is missing. This is of course because the program can find the DLL on my system, but not on theirs.
Is there a way to scan an executable for DLL dependencies or execute the program in a "clean" DLL-free environment for testing to prevent these oops situations?
dumpbin
from Visual Studio tools (VC\bin folder) can help here:
dumpbin /dependents your_dll_file.dll
I can recommend interesting solution for Linux fans. After I explored this solution, I've switched from DependencyWalker to this.
You can use your favorite ldd
over Windows-related exe
, dll
.
To do this you need to install Cygwin (basic installation, without additional packages required) on your Windows and then just start Cygwin Terminal
. Now you can run your favorite Linux commands, including:
$ ldd your_dll_file.dll
UPD: You can use ldd
also through git bash terminal on Windows. No need to install cygwin in case if you have git already installed.
Figure out the full file path to the assembly you're trying to work with
Press the start button, type "dev". Launch the program called "Developer Command Prompt for VS 2017"
In the window that opens, type
dumpbin /dependents [path]
, where[path]
is the path you figured out in step 1press the enter key
Bam, you've got your dependency information. The window should look like this:
Update for VS 2019: you need this package in your VS installation:
- There is a program called "Depends"
- If you have cygwin installed, nothing simpler then ldd file.exe