Say I have libA. It depends on for example libSomething for the simple fact that a non inline method of libA makes a call to a method in libSomething.h. How does the dependency link up in this case? Does libA have to statically link to libSomething when it is compiled, or will a user of libA (an application using libA) need to link to both libA and libSomething?
Thanks
Static linking is just copying the whole items (functions, constants, etc) into the resulting executable. If a static library's code contains references to some shared library items, these references will become dependencies in the resulting executable. The same holds if you link a library instead of executable.
This thread discusses how it happens in Linux.
A static library is more or less a simple archive of unlinked binary object files (*.o or *.obj), when compiling the archive, no checking is done for dependencies. When one linked one's binary executable (or shared library / DLL) the linker checks for all the necessary dependencies and only then will alert you to any issues.
During the build process the compiler translates code into a temporary format, let's call it an object file. In the object file, there is a list of symbols that the compiler could not resolve, usually definitions elsewhere. The linking phase is in charge of resolving these symbols.
The build process feeds files to the linker until all symbols are resolved. There is no physical dependency lists, just lists of symbols to resolve. This allows for symbols to be resolved by using different libraries. For example, one may want to use a Windows library for Windows specific issues; a linux library for linux specific issues. This does not explicitly state that a program is dependent on a Windows library; it could also be dependent on the Linux one.
Some compilers can generate dependency lists, usually for usage in a build process. However, the ultimate responsibility is up to the programmer.