From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3711e6f8ef1eb92b X-Google-Attributes: gidfee84,public From: Harold Seigel Subject: Re: Auto template instantiation DEC C++ V5.3-004 Date: 1996/07/02 Message-ID: <31D9897C.41C6@tle.enet.dec.com>#1/1 X-Deja-AN: 163434301 references: <4qaukv$pg9@doc.zippo.com> content-type: text/plain; charset=us-ascii organization: CTG mime-version: 1.0 newsgroups: comp.unix.osf.osf1 x-mailer: Mozilla 2.0 (X11; I; OSF1 V3.2 alpha) 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++)