[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3502.0. "Instantiated template objects in archive library?" by NETRIX::"AustinK@mail.dec.com" (Keith Austin) Tue Mar 18 1997 20:46

A customer of mine is using templates and is getting unresolved symbols at
link
time.

The problem occurs when a source file gets compiled (a.C), it generates a
bunch 
of template instantiated objects in ./cxx_repository, which don't get archived
into the library like a.o does.  So, a.o gets into the archive library and the
instantiated objects in ./cxx_repository don't; then, at link time there are
unresolved symbols.

Any ideas on how to best approach this?

TIA,

-Keith Austin

[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
3502.1DECC::FOLTANWed Mar 19 1997 12:3511
Look in the "Using DEC C++ for Digital UNIX
Systems" guide.  Chapter 5 on Templates, section
5.2.9 describes in detail how to build
libraries and applications that use templates.
Pay particular attention to section 5.2.9.1.1
and the description of the -Hf command line
option.  I think this is what you will eventually
want.

Lois
3502.2Similar problem / ?ASIC::DEEGANWed Mar 26 1997 04:4012
    Well this works fine if you have only the library being compiled
    in the area.
    
    I'm working on a tool suite, where both the library and a program
    which both use templates are compiled.  If I do what the manual
    sugguests I end up with .o's for template instances which shouldn't be
    in the library and cause unresolved symbols.
    
    Wouldn't it be nice if building shared libraries workd like building
    the executable and pulled the appropriate templates instances into the
    .so's?  Is this possible, is this planned?