This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: second attempt to report bug: incorrect behaviour of -frepo (fwd)
On Jan 10, 2000, "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de> wrote:
>> /As mention in gcc documentation, for doing this I must compile objects
>> with -frepo switch and try to link it together before creating library/
> No.
That's exactly what the -frepo docs recommend for instantiating all
templates before creating a library:
gcc.info(Template Instantiation)
[snip]
For library code, if you want the library to provide all of the
template instantiations it needs, just try to link all of its
object files together; the link will fail, but cause the
instantiations to be generated as a side effect. Be warned,
however, that this may cause conflicts if multiple libraries try
to provide the same instantiations. For greater control, use
explicit instantiation as described in the next option.
> I don't know why you invoke the compiler in this case.
That's exactly what is suggested in the docs. But it would probably
have been wise to tell gcc to output the resulting binary to, say,
/dev/null. And the exit status of the command should be ignored. The
correct rule would be:
libss.a: x1.o x2.o
-$(CXX) $(CXXFLAGS) x1.o x2.o -o /dev/null # instantiate templates
ar -cru libss.a x1.o x2.o
> I believe the testsuite currently does not support multi-file
> tests.
It does. See g++.pt/instantiate5* for an example.
>> 4. If this my bug:
>> Are exists example of creating c++ library with automatic template
>> instantiations somewhere in the net ?
> Well, just use the mechanism that does not involve any command line
> switches. It should work just fine on ELF-based systems using the GNU
> linker.
That's not always an option. Some widely-used platforms still lack
support for ELF and GNU ld.
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them