Hello Is there any progress or start yet in implemententing export for C++ templates ?
A search in the mailing list archive shows the last time the issue was discussed was in 2006. Why is everybody such not interested in this ? It would be such a great feature, especially for a leading C++ implementation like gcc ... Why is it so hard to store template definitions (and the set of symbols visible to them) in an object file, probably as a representation of the parsed template source tree ? A compiler-provided tool (or even the compiler) would then be invoked as a separate step in the build process before linking, being passed all such object files (named translated translation units by the standard) in the program, same as the linker is given all the object files. This tool would then examine the translated units in order to: - identify the required template instantiations, - find the template definitions - instantiate them (event in a separate output file, later to be passed to the linker as an object file) It is a matter of giving the compiler (compiler-provided tool) access to all translation units in the program at some point before linking, in a new step in the build process. Such a tool would share attributes of: - a compiler, in that it generates object code, but only from the encoded template definitions, and - a linker, in that it has the entire program at its disposal and it resolves references, but only references between required template instantiations and template definitions. To put it simple though it is just: "the compiler having all the object files of a program", or like having gcc understand a some type of input file: parsed-template-definition object files, and then have gcc output some regular object file from this new input files. The linker in the end should stay out of all these and only get the instantiated, regular object files. So a Makefile to explicitly go through the build steps would be like array_tmpl.o: array_tmpl.cc g++ -c -o array_tmpl.o array_tmpl.cc hash_tmpl.o: hash_tmpl.cc g++ -c -o hash_tmpl.o hash_tmpl.cc main.o: main.cc g++ -c -o main.o main.cc templ_inst.o: main.o array_tmpl.o hash_tmpl.o g++ -instantiate-only -o templ_inst.o main.o array_tmpl.o hash_tmpl.o main: main.o array_tmpl.o hash_tmpl.o templ_inst.o ld main.o arrray_tmpl. hash_tmpl.o templ_inst.o Any thoughts ? Thank you, Timothy Madden