find the list of all libraries was used in a C program (.exe)


This question already has an answer here:

  • Show all libraries used by executables on linux 10 answers

I am wondering if there is any tools, or even GCC options which one can check and find the list of all required and used libraries in a C program.There is a code and it should be check against all of its required (used) libraries and dependencies. Also I want to check whether any non-standard (user-defined) libraries has been used in the code or not.

(Looks like you are asking about Windows. For Linux see Show all libraries used by executables on Linux)

You have two options: using objdump or using Dependency Walker on Windows. objdump is a part of the MinGW/mingw-w64 toolchain, which means that you can use it on Linux if you have a cross compilation toolchain ready, while Dependency Walker is a Windows app.


${CROSS}objdump -x blah.exe | grep -i DLL | sort | uniq
# not sure I got everything correct because I don't have access to my laptop to test it out

Using Dependency Walker: just open the exe in depends.exe and it will tell you that.