On 07.03.20 14:36, Steven Watanabe via Boost wrote:
On 3/6/20 10:41 PM, Rainer Deyke via Boost wrote:
Problems with linkable libraries include: - I have to compile them, which means either messing with their native build system, trying to get it to build on all of my platforms using all of my cross-compile toolchains, or replacing their native build system with my own. The latter is often easier than the former.
This is not a difference between compiled libraries and header only libraries, per se. It's a result of the fact that being header-only forces you to write portable code, because you can't rely on the build system to handle complicated configuration steps.
If you make a compiled library that contains exactly the same code that you would write for a header only library, "replace the native build system" becomes "glob the sources and add them to your project"
That's an approach that works fairly well with a fair number of libraries. Things to watch out for include non-library source files mixed in with library source files, #include paths, and of course any complex build processes that go beyond "compile these files and link them". All compiled libraries introduce some friction, but in some cases the amount of friction is trivial, and in other cases it is extreme. A header-only Boost library introduces no friction at all for me. -- Rainer Deyke (rainerd@eldwood.com)