
John Maddock wrote:
Vladimir Prus wrote:
I think this fact that mere use of a single boost::regex function cause a bunch of implementation functions to be added to libtest.so to be unfortunate -- besides possible performance issues you've found, it also code bloat, and may be dangerous if different versions of internal functions are included in different libraries. Without further investigation, I don't know how easy it is to fix.
Surely this is true of *any* template though - if it's used by two different shared libraries then both instantiate and get a complete copy of the template. If the two libraries are built with different build options, then you get ODR violations with all that means. Unless I'm missing something I don't see anything to be fixed here, that's just how templates work?
Of course, a template function that is used gets instantiated and added to shared library. The question, however, is whether it's OK for 173 symbols to be instantiated, bringing the test.so size to 175309 bytes? It's 30% of the size of boost_regex.so itself. There are various approaches to reduce the percentage of templated code; which of them will work here can be only decided by looking at the symbols that are now included in all client .so libraries. - Volodya