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.
Asked
Active
Viewed 1,244 times
2
-
1@IsmailBadawi ldd doesn't work for Windows. – Timothy Gu Jun 08 '14 at 04:27
-
1@Timothy_G Do you think we should retag this question for Windows? – JasonMArcher Jun 08 '14 at 05:21
-
and one more question: could you please tell me how can I compare the library that is used in the code project with the library that is given to me? to check if they are exactly the same and its the last version? – zhuan Jun 08 '14 at 06:10
2 Answers
2
(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.
objdump:
${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.

Community
- 1
- 1

Timothy Gu
- 3,727
- 28
- 35
-
thanks, and one more question: could you please tell me how can I compare the library that is used in the code project with the library that is given to me? to check if they are exactly the same and its the last version? – zhuan Jun 08 '14 at 05:39
-
1
on Linux / Unix systems use ldd.
on Windows you can use 'Dependance Walker'
I don't use Mac that much, but I would guess that ldd would also be available there.

thurizas
- 2,473
- 1
- 14
- 15