From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3711e6f8ef1eb92b,start X-Google-Attributes: gidfee84,public From: nbacon@ibm.net Subject: Auto template instantiation DEC C++ V5.3-004 Date: 1996/06/20 Message-ID: <4qaukv$pg9@doc.zippo.com>#1/1 X-Deja-AN: 161251966 organization: European Commission newsgroups: comp.unix.osf.osf1 DEC C++ V5.3-004 on Digital UNIX V3.2D-1 (Rev. 41) Here's my experience of auto template instantiation. 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 This symbol is in module cxx_exc.o of library /usr/lib/libcxx.a, which is supposed to be linked in by default. >From nm: Name Value Type Size __cxx_gem_dispatch | 0000000000004496 | T | 0000000000000008 $ ar x /usr/lib/libcxx.a cxx_exc.o $ cxx testVector.cxx cxx_exc.o $ a.out 0 1 2 3 Now its ok! Strange because "cxx -v testVector.cxx" shows that these libraries are linked in: -lcxxstd -lcxx -lexc -lots -lc. Extra libraries specified on the command line go in front of these. -------------- 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). Just before linking cxx compiles all the template code it has previously produced in templateRepositoryDir. 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. Conclusion: Auto template instantiation works ok for baby test programmes, but isn't yet good enough for real work. One day it will be a great feature and we will really need it to use the STL!