On installing boost library (of which boost graph library is a part), the following has been installed on my computer:
(1) C:\local\boost_1_86_0\boost\graph\header files.hpp
(2) C:\local\boost_1_86_0\lib64-msvc-14.3\boost_graph-vc143-mt-x64-1_86.dll (305 kb size)
(3) C:\local\boost_1_86_0\lib64-msvc-14.3\libboost_graph-vc143-mt-x64-1_86.lib (2897 kb size)
(4) C:\local\boost_1_86_0\lib64-msvc-14.3\libboost_graph-vc143-mt-s-x64-1_86.lib (3191 kb size)
Looking at https://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html#library-naming, I infer that (3) and (4) are static libraries because they have a lib prefix, while (2) is obviously a dll.
Given that (3) and (4) are already static libraries, what is the need for (4)? According to that documentation, the "Key" of s in a name indicates:
linking statically to the C++ standard library and compiler runtime support libraries.
(Q1) What differentiates (3) and (4)? Is (3) NOT statically linked to C++ standard library and compiler runtime support libraries? If not, how is (3) getting linked to the standard library and runtime support libraries?
(Q2) Given the static libraries' size of 2897 kb and 3191 kb as opposed to the dll size of 305 kb, does this mean that all of the boost graph library code (and all its algorithms, maxflow, dijkstra shortest path, minimum spanning tree, etc.) is contained completely within these files as object files? Suppose I build an application .exe file on one computer by linking statically to (3) or (4) which runs some boost graph algorithm, can I just take the executable along with either (3) or (4), copy it on a new machine which does not have boost installed at all and expect the executable to run fine? Or, because these are static libraries, the executable will already contain the boost graph library algorithm baked into it and therefore one actually just needs the executable and does not even need (3) or (4) either on the new machine?
(Q3) Can one link dynamically (using MSVC /MD compiler flag) to (3) and (4) and can one link statically (using MSVC /MT compiler flag) to (2) or should one only link statically to a static library and link dynamically to a dll?
(Q4) If one does link to (2) [either using /MD and /MT flag], because the linking has been done to a dll, one cannot just take the executable and expect it to run on another machine which does not have this boost installed. Is this correct?
(4) is the same as (3) but with some lower level libraries baked in. Most people would not use (4).
because these are static libraries, the executable will already contain the boost graph library algorithm baked into it and therefore one actually just needs the executable and does not even need (3) or (4) either on the new machine?
Correct. Static linking means you deploy the .exe without the separate library files.
should one only link statically to a static library and link dynamically to a dll?
Correct.