89

If I have a Windows executable, how can I find out which dlls it will load?

I'm just talking about which ones that will be loaded statically, not ones it might load dynamically with something like LoadLibrary.

10 Answers 10

79

dumpbin is a tool that comes with VC++.

To see what DLLs a program will import:

  • Open Visual Studio
  • Menu Item Tools | Visual Studio Command prompt
  • cd to folder containing executable
  • dumpbin /dependents whatever.exe
Dump of file whatever.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    AIOUSB.DLL
    sqlite3.dll
    wxmsw293u_core_vc_custom.dll
    wxbase293u_vc_custom.dll
    KERNEL32.dll
    ole32.dll
    OLEAUT32.dll
    MSVCP90.dll
    MSVCR90.dll

To see what functions (and DLLs) it will import, use

C:\> dumpbin /imports whatever.exe
3
  • 5
    I believe it should be: dumpbin /dependents whatever.exe Commented Mar 19, 2009 at 1:53
  • 4
    /dependents only shows you the DLLs. /imports shows you functions and DLLs. Commented Mar 19, 2009 at 16:46
  • 3
    This is the best answer. Unfortunately this tool shows only DLLs loaded directly for the .exe not DLLs which the executable file depends on them indirectly.
    – SuB
    Commented Nov 2, 2016 at 5:02
39

There are utilities that will do this for you.

In the past I've used the MS tool (depends.exe) that came with (I think) VB.:
VS2010 VS2012 VS2013 VS2015 Current

and there's this as well:
http://dependencywalker.com/

and probably others as well.

2
  • 7
    The "depends.exe" that's installed with Visual Studio/VB/... and the "depends.exe" that one can download from dependencywalker.com are exactly the same tool (only different versions). ;)
    – Paul Groke
    Commented Jul 25, 2011 at 22:01
  • 2
    The link is dead.
    – ice1000
    Commented Nov 28, 2019 at 9:57
23

Open the command prompt and then type below command

tasklist /m /fi "imagename eq netbeans.exe"

Type instead netbeans.exe whatever name your exe file name.

2
  • 1
    i used this and its not giving me full list of dlls that its using, there are a bunch of crystalreports dlls that my exe is using but i dont see any mentioned in the list printed through that command. Any ideas?
    – user734028
    Commented Feb 14, 2018 at 6:50
  • 1
    I think this needs the application to be running
    – Bitterblue
    Commented Feb 3, 2023 at 10:53
13

Dependency Walker can help you determine which .dll will be loaded.

1
  • Nice GUI program. Dependency Walker try to find DLLs and their hierarchical dependencies.
    – SuB
    Commented Nov 2, 2016 at 4:59
12

Just go to the command prompt and type tasklist /m, you will see the list of dll files used by specific program.

2
  • Yeah, this does what you say, however, if an executable start multiple processes, you will never find out from command line which process was started by the executables, hence you will not know all the dependent dll's of the executable.
    – Fazi
    Commented Jul 19, 2013 at 8:00
  • Doesn't load the paths. Commented Nov 5, 2020 at 20:30
3

Solution for Microsoft .Net:

foreach (AssemblyName a in Assembly.ReflectionOnlyLoadFrom("SAMPLE.EXE").GetReferencedAssemblies()) 
{
    MessageBox.Show(a.Name); 
}
1
  • This solution doesn't include the reference dlls that is required from it's children.
    – user4954249
    Commented Feb 24, 2021 at 16:44
2

There is a handy tool called NDepend that will give you all DLL dependencies.

3
  • NDepend is a static analysis tool for .NET managed code'. So it works only for .Net applications.
    – SuB
    Commented Nov 2, 2016 at 20:19
  • You forgot to mention that it works as a vs extension. Commented Nov 5, 2020 at 20:30
  • @SuB a C++ version of NDepend exists: cppdepend.com Commented Mar 21, 2022 at 11:05
1

progfr is simple and useful: [http://members.fortunecity.com/michaelmoser/tip11.htm]

1

Dependencies - An open-source modern Dependency Walker shows which DLLs a Windows executable will load and it works well in modern Windows 10.

It is a little less powerful than Dependency Walker, but the latter may or may not work in Windows 10 as it was last updated in 2006. (Newer versions of Dependency Walker were bundled with some versions of Windows Development Kit for Windows 10, but not any more.)

0

Process Explorer Comes with SysInternals Suite https://learn.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite

Benefits: allows to explore the process that is already running (I have not found a was to attach the dependency walker to the existing process)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.