How do I find out which dlls an executable will load?

DllExecutable

Dll Problem Overview


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.

Dll Solutions


Solution 1 - Dll

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

Solution 2 - Dll

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.

Solution 3 - Dll

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.

Solution 4 - Dll

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

Solution 5 - Dll

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

Solution 6 - Dll

Solution for Microsoft .Net:

foreach (AssemblyName a in Assembly.ReflectionOnlyLoadFrom("SAMPLE.EXE").GetReferencedAssemblies()) 
{
    MessageBox.Show(a.Name); 
}

Solution 7 - Dll

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

Solution 8 - Dll

Solution 9 - Dll

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.)

Solution 10 - Dll

Process Explorer Comes with SysInternals Suite https://docs.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)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid NormanView Question on Stackoverflow
Solution 1 - DllGraeme PerrowView Answer on Stackoverflow
Solution 2 - DllgkrogersView Answer on Stackoverflow
Solution 3 - DllLOKESHView Answer on Stackoverflow
Solution 4 - DllDavid SegondsView Answer on Stackoverflow
Solution 5 - DllSubek ShakyaView Answer on Stackoverflow
Solution 6 - DllhtcView Answer on Stackoverflow
Solution 7 - DllFlySwatView Answer on Stackoverflow
Solution 8 - DllanonView Answer on Stackoverflow
Solution 9 - DllmrtsView Answer on Stackoverflow
Solution 10 - DllOverInflatedWalrusView Answer on Stackoverflow