std C/C++ patch #6

David Scott Page page at cs.utexas.edu
Fri Apr 26 14:54:38 EDT 2002


Eddie,

> > Inline functions have internal linkage, hence the inline methods of
> > hashmap.cc, such as bucket(), as instantiated in tools/lib/hashmapi.cc
> > have internal linkage and are not available to other library users at
> > link time.  Until the standard's export template instantiation model
> > is implemented, exported inlines need to stay in header files.
> 
> What about declaring the resize() and bucket() functions as inline in the
> template class declaration? (Change "int bucket(const K &) const;" to
> "inline int bucket(const K &) const;".) This has worked for me in the past
> with conventional classes. What does your compiler say?

KCC (actually, nm) still says "LOCL", i.e., internal linkage, for
hashmapi.o in the archive. Also, changing the declaration to "inline"
(and not providing a definition in the header) results in a
compilation error for some files including hashmap.hh (e.g.,
tools/click-pretty/html.cc), since the hashmap.hh inline methods
find() and findp() reference bucket().  

--
Scott Page




More information about the click mailing list