0

With reference to the answer to Linking a static boost build into a static library under VS2012 & Win32/64:

In essence I have produced a library, A.lib, which is dependent on another of our internal libraries, B.lib, as well as the Boost libraries libboost_system-vc110-mt-gd-1_51.lib and libboost_filesystem-vc110-mt-gd-1_51.lib.

Now, my colleague on another team is using my library, A.lib, and as I would expect from reading the aforementioned answer, he gets a linker error because he does not have the boost library in his linker path.

I solved the issue by simply packaging the particular boost library in the same folder as A.lib.

However, what puzzles me is that this actually seems to work. Why does the linker not complain about B.lib missing?

B.lib is built by yet another team (and I do not have access to the source code), so in my mind linking to that should be equivalent to linking to a boost library.

Community
  • 1
  • 1
  • 1
    My guess is, your colleague just happened to only use parts of A.lib that didn't actually depend on B.lib. Dependencies are between individual .obj files packed into a lib, not between lib files as a whole. – Igor Tandetnik May 02 '14 at 17:06
  • Well, A.lib contains just one function, which calls functions in B.lib as well as functions in the Boost libraries. And that is what puzzles me. It seems as if the functions A.lib needed from B.lib was incorporated in A.lib, while this does not hold for the Boost functions needed by A.lib. – Steffen Skov May 03 '14 at 10:18
  • Say B.lib defines class X and Y, while A.lib defines class Z derived from class Y and calls X.Foo() which in turn calls the virtual Y.Bar(). Could the compiler/linker then decide to incorporate X.Foo() in A.lib? – Steffen Skov May 03 '14 at 10:30
  • If `X::Foo` is defined in a header, then it could be inlined (and thus, in a sense, incorporated into A.lib). – Igor Tandetnik May 03 '14 at 14:21
  • Yes, that could have explained it, however all methods in X are only _declared_ in the header, i.e. not inlined. – Steffen Skov May 05 '14 at 07:55

0 Answers0