This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: using templates in shared library
- To: martin at mira dot isdn dot cs dot tu-berlin dot de (Martin von Loewis)
- Subject: Re: using templates in shared library
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Mon, 14 Dec 98 9:12:57 PST
- Cc: jbuck at Synopsys dot COM, K dot Peeters at damtp dot cam dot ac dot uk, egcs at egcs dot cygnus dot com
[ deleting duplicate template instantiations at link time ]
> > Ideally, we should also be able to do the same with shared libraries.
>
> This was my first impression, as well. But then, the implicit
> instantiation in the shared library might go away, which would mean
> that we have to recompile all applications relying on it.
Just the same, some libraries may be template-heavy enough so that
if the library doesn't have the needed template instantiations, far
less code will be shared.
If we want the library to be highly reusable, and are willing to pay a
space penalty to achieve this, we can get rid of all but one of the
instantiations in the library, and use that instantiation to satisfy
internal references (for calls within the library), but not export it to
external code.
But some people may want maximum space efficiency even if it means
more recompiles for library changes.