[might be a bug] Solaris vs Linux template handling

Lavoie Philippe lavoie@yoho.genie.uottawa.ca
Thu Apr 29 06:14:00 GMT 1999


Alexandre Oliva writes:
 > On Apr 28, 1999, Lavoie Philippe <lavoie@yoho.genie.uottawa.ca> wrote:
 > 
 > > I used -frepo and only explicitely mentionned
 > 
 > AFAIR, there may still be some problems in -frepo on some platforms,
 > in the latest release.  :-(
 > 
 > Don't you want to just leave duplicate symbol elimination up to the
 > linker and use the default template instantiation mechanism?
 > 

But how can I create a library then ? 

At one point I need to say to the library

I want NurbsCurve<float,3>, NurbsCurve<float,2>, NurbsCurve<double,3>

A long time ago I tried a method where all the sources are available,
by including them inside the header files (windows VC++ needs that).
Which is what -frepo is all about I suppose, but I still think the
right way it to hide the implementation (20,000+ lines of codes) and
only allow the user to see the header files. 

Also, maybe I was using an old linker last time I did tests, but
basically when a tempalte specialization is defined, the linker
complains that it is multiply defined. 

i.e.

--implement.cc

template <> void f<float>();


--implement.h

#include "implement.cc"


-- main.c

#include "implement.h"

-- func.c

#include "implement.h"


With above situation, f<float> is multiply defined. 

As this changed ?

Phil


More information about the Gcc-bugs mailing list