Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Harold Seigel <seigel@tle.enet.dec.com>
Subject: Re: Auto template instantiation DEC C++ V5.3-004
Date: 1996/07/02	[thread overview]
Message-ID: <31D9897C.41C6@tle.enet.dec.com> (raw)
In-Reply-To: 4qaukv$pg9@doc.zippo.com


nbacon@ibm.net wrote:


> Error linking 1st DEC STL example in "Using DEC C++ for Digital UNIX Systems"
> section 6.5.
>
> $ cxx testVector.cxx
> ld:
> Unresolved:
> __cxx_gem_dispatch


By default, DEC C++ links programs with shared libraries.  Hence, in the above
example, the program is linked against libcxx.so, not /usr/lib/libcxx.a.

To verify that your system has the correct version of libtask.so, please use
nm to check that __cxx_gem_dispatch is defined in libcxx.so.

        % nm /usr/shlib/libcxx.so | grep __cxx_gem_dispatch

If __cxx_gem_dispatch is not defined in /usr/shlib/libcxx.so then please install
the CXXDHRDA307 subset as described in the Installation guide.

If __cxx_gem_dispatch is defined in /usr/shlib/libcxx.so then please relink
using the -v option and please send me the output.


> Then I tried compiling the project I'm working on and had far worse problems.
> The project is split into 3 parts each in its own directory (we make a library
> from each of the first 2 parts and link them with the .o's from the 3rd part).
> All 3 parts use templates and some are in common between the parts. To share
> the template instantiations, I pass the same '-ptr templateRepositoryDir' args
> to cxx when compiling each part. It compiles successfully, but I think slower
> than with manual instantiation (pragma define_template).

Manual instantiation is faster than automatic instantation because the needed
templates can be instantiated as part of the compilation of the requesting
source file.  Automatic instantation is not intended to be faster than manual
instantiation.  Its purpose is to allow users to avoid having to go through
the sometimes tedious process of figuring out the "#pragma define_template"
statements needed to do manual instantiation.

> Just before linking cxx compiles all the template code it has previously
> produced in templateRepositoryDir.

Normally, the DEC C++ automatic template instantiation process does not
recompile previously compiled template code unless it detects that either
command line options that could affect compilation have changed or that header
files have changed.  Why this happened in your case requires further
investigation.


> This is hideously slow (about 4 hours for
> me)! Compiling with -g I ended up with over 100Mb of template .o's. ld fell
> over with 'cannot malloc'. When I tried to build a library of the template
> .o's, ar fell over with 'bad file number'. I did succeed in stuffing all the
> template .o's into 5 different libraries, but ld still fell over. Then I
> recompiled with -O2 and managed to build an executable.

Automatic template instantation has been reworked in DEC C++ V5.4.  Instead
of compiling a different file for every template function, DEC C++ V5.4 groups
functions of the same class into one file.  In many cases, this can greatly
improve instantation time.  It also reduces the size of the final ld command
and so can prevent ld from falling over because of capacity problems.


Harold Seigel (DEC C++)



      reply	other threads:[~1996-07-02  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-20  4:00 Auto template instantiation DEC C++ V5.3-004 nbacon
1996-07-02  4:00 ` Harold Seigel [this message]
read-only archive

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