I'm new to C++. When I write a program I expect it to compile into a standalone executable, but with C++ there's a lot of talk about dynamic and static linking. From what I gather this means the separate libraries used are compiled separately and linked rather than compiled together.
Compile time is not an issue for me. I don't see why I want to link to a library rather than compile it directly with my code as one. Surely that would result in better optimization and inlining.
A perfect example is tcmalloc. I'd like to to use the tcmalloc memory allocator, not the profiler that is bundled with, and not link to it statically or dynamically, but compile it directly into my program with inlining optimizations.
How do I do that?