Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static library with dependencies

Tags:

e.exe is linked against my custom static library, c.lib, which uses Win32 API defined in w.dll. w.dll is located in C:\Windows\System32 and its import library is w.lib, located in Windows SDK directory. Shell w.lib be listed as Additional Dependency in c.lib or e.exe project? (e.exe builds successfully in both cases.) What is the best practice and why? I guess e.exe should not know about w.lib.

c.lib is intended to be shared among a group of developers only (not to be shipped to customers).

TEST: I used VS2008 and dumpbin utility to test both cases and here are results:

  • Case 1: w.lib added as Additional Dependency in c.lib project.

dumpbin /archivemembers c.lib output lists both offsets in w.dll and .obj files from c.lib project as Archive members.

  • Case 2: w.lib not added as Additional Dependency in c.lib but in e.exe project:

This time, dumpbin output contains only .obj files of c.lib and the size of c.lib is smaller than in Case 1

(c.lib was added as Additional Dependency in w.exe project in both cases.)

NOTE: I used w.lib and w.dll here as fictional, generic names for Windows libraries but they could be e.g. Userenv.lib and Userenv.dll or Version.lib and Version.dll...