Using -frepo

Joe Buck jbuck@synopsys.com
Tue Jan 13 17:53:00 GMT 1998


> What is the correct way to organise things to be able to use -frepo to
> automatically instanciate templates?

Regardless of whether you use -frepo or not, the compiler have seen the
template definitions (not just the declarations) at the point of
instantiation.  So if you put template definitions in a .cxx file
you must #include that file.

If you are on an ELF platform (Linux, Solaris or UnixWare), I would advise
against -frepo; just do templates with no special flags.  The tools will
do the right thing, you'll get only one copy of each function in the
executable (if you use the GNU linker), and it will be a lot faster.
For some other platforms, there may be advantages to -frepo, but it will
be slow in many cases (many link-compile-link iterations).

> In order to use -frepo, would I need to include the template definitions
> along with the template declarations all the time, and the compiler works
> out all the necessary instantiations?

Yes.  (and if you don't give -frepo, then the compiler will instantiate
needed functions in each .o file and set things up so that the linker will
remove duplicates on platforms where this works, or make them static on
platforms where it doesn't work).




More information about the Gcc mailing list