Reputation: 3717
I'm developing a small ATL DLL file in Windows/Visual Studio IDE, and I'm relatively new to C++/Boost. I've added the Boost library directory under the Linker options, and added the Boost root directory as an additional include directory. In my code I'm adding it like:
#include <boost/algorithm/string.hpp>
Will this be statically linked, dynamically linked, or not linked at all?
Upvotes: 0
Views: 256
Reputation: 33116
Will this be statically linked, dynamically linked, or not linked at all?
The answer is "It depends".
Boost is big. To steal a line from Douglas Adams, Boost "is big. Really big. You just won't believe how vastly, hugely, mindbogglingly big it is."
Some parts of Boost are implemented purely as templates: There are no calls to functions that were previously compiled and stored in some library. Use just these parts of Boost and there is no need for the Boost library.
Other parts of Boost do call functions that were previously compiled and stored in some library. These will need to be linked in. Whether that is done dynamically or statically depends on (a) whether you (or some sysadmin) built the Boost library as a dynamic vs. static library, and (b) how you (or your makefile) tells the linker to treat the Boost library.
Upvotes: 3
Reputation: 63775
Including any headers will embed that code in your source files for compilation.
So the code will be linked, as all your symbols will be, but it's not separately linked.
Upvotes: 2