Template Instantiation

David Greene greened@eecs.umich.edu
Sun Feb 8 11:38:00 GMT 1998


First off, great job with egcs!  This project is a BIG help!

Now on to the question:

Can someone clarify exactly how template instantiation
works in egcs?  I'm using x86/Linux/ELF and SPARC/Solaris 
systems.  

I've been using -frepo when linking object files.  When creating 
liraries, I've been manually instantiating templates though IIRC, 
someone mentioned that this wasn't necessary.

In the (very outdated) g++ FAQ at www.cygnus.com, I
found this passage:

   Jason Merrill writes: "To perform closure on a set of objects, just try
   to link them together. It will fail, but as a side effect all needed
   instances will be generated in the objects." 

Maybe I'm dense, but I don't understand this.  If I link object
files using -frepo, recompilation takes place and there is no
failure.  If I link using libraries, it fails, but nothing gets
generated.

I also seem to recall someone indicating that -frepo wasn't
necessary under ELF.  Is this true?  It would certainly reduce
build times.  What do I do to get everything to link correctly?

Thanks much for the help!

                                    -Dave




More information about the Gcc mailing list