Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Problem with template instantiation using cxx 6.0 compiler
@ 1998-09-11  4:00 Snow Wang
  0 siblings, 0 replies; only message in thread
From: Snow Wang @ 1998-09-11  4:00 UTC (permalink / raw)


I need to
build an
application
that uses
template
on DEC OSF
4 using
cxx 6.0
compiler.
In
addition
to the
template
classes we
declared,
ObjectSpace
STL is
used. To
avoid code
bloat, we
want each
template
class to
be
instantiated
just once,
in the
repository,
instead of
being
instantiated
in every
translation
unit that
needs that
template
class.

cxx 6.0
compiler
does
template
instantiation
at compile
time
(automatic
template
instantiation)
instead of
at linking
time, and
a
repository
can be
specified
by -ptr
dir_path
to store
the
instantiation.
The
documentation
claims
that when
translation
unit is
compiled
and
template
class is
encountered,
it looks
into the
repository
to see if
it has
been
instantiated.
If so, it
uses the
one in the
repository,
otherwise
it
instantiates
it in the
repository.
I tried
building
it with
-ptr flag,
but I
found
instantiation
was done
both in
the
repository
and in all
the object
files that
need that
template
class,
causing
the linker
to
complain
that some
template
classes
are
multiply
defined.
But if I
build it
with -nopt
flag to
disable
the
automatic
template
instantiation,
no
instantiation
will be
done at
all.

I wonder
if anybody
had
problems
like this
before and
certainly
will
appreciate
it if you
can tell
me how to
do it
right.
Thanks!


Snow Wang




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-09-11  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-09-11  4:00 Problem with template instantiation using cxx 6.0 compiler Snow Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox