I’ve been playing around with a finance library called QuantLib (http://quantlib.org/index.shtml) which I’ve been trying to statically link into one of my Visual C++ programs.
Now, upon initially seeing the size of the static Quantlib library provided (> 400 megs), I was a bit alarmed, as I expected a huge executable file, yet somehow the exe remains small, almost as if the build was dynamically loading only the relevant parts of the library.
Can you advise if there are any Windows programming techniques that might allow this type of “sparse” linking behavior against a huge static library?
Well, if your project contains code that isn’t referenced from anywhere (and isn’t going to be exported), it gets removed when building the executable.
It’s exactly the same with a static library – if you don’t use a function contained in the library, it won’t be included.