Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building dependency trees

How do I build a dependency tree using C++? By dependency tree I mean, for example, checking what files a certain program needs in order to run. By checking that, I could find if there are any missing or corrupt files.

How do I do something like that?

edit:

I'm not looking for a program that does it for me!

like image 860
Lockhead Avatar asked Mar 23 '11 21:03

Lockhead


1 Answers

There is no cross-platform method for calculating dependencies, because this is not actually a C++ problem. It is related to the executable format output by the compiler, and that is different on each platform.

On Linux (and probably other Unices), the ldd command is what you want. This prints out the (recursive) modules that will be required by the executable, and also tells you where they can currently be found on your system.

On Windows, Dependency Walker is an excellent graphical tool that lets you explore all of the DLLs that an executable (or another DLL) depends upon.

like image 125
mgiuca Avatar answered Sep 22 '22 23:09

mgiuca