This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: why are stl template classes not mangled as other classes andtemplates
On Wednesday 28 November 2007 12:35, Dave Korn wrote:
> On 28 November 2007 17:33, Stephane Hockenhull wrote:
> > something just occured to me ... the std::string template is not compiled
> > into the .s file
> >
> > are those templates pre-compiled into some "magical" hidden library?
> > I could not find them in my gcc installations both native and
> > i386-unknown-elf
> >
> > grep 'ZNSs7replaceEmmRKSs' * -R
> >
> > didnt find anything (compressed?).
> >
> > where is that template instanciated ?
>
> The instantiations end up in the .o files of your project when you
> compile, not in the compiler or its support libraries. Does this page:
>
> http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html#Template-Inst
>ant iation
>
> answer the question for you?
>
>
> cheers,
> DaveK
no, it does not.
I know templates *NORMALLY* end up in the .s file after the compilation pass
then the .o file after the assembly pass.
if you actually read my email I said :
> > the std::string template is ----> ****NOT**** <---- compiled into the .s
file
g++ does not seem to put the std::string template's code into the .o file like
the other templates.
it seem to NOT be instanciated in the .o file.
I guess it would make sense to have the std::string class compiled once
instead of in every file since its used everywhere, that would greatly speed
up compile time but would cause problem in my case.
I have the .s file right here and there is no assembly code for the
std::string template's instance at all. my other templates are there, just
not std::string.
hence my question: where is it?
and, if it IS precompiled, can I force g++ to compile td::string every time to
see if that fixes the problem?
--
Stephane Hockenhull
SSC-Studios.com