Boost logo

Boost :

From: yigal dayan (yigal_at_[hidden])
Date: 2003-12-29 10:13:01


Boost version: 1.30.0
Platform: Solaris 2.8
Compiler: Sun CC 5.5 (with -library=stlport4)

Problem:

We have a shared library that wraps around the
boost_regex_mt.so library.

Our library calls
boost::reg_expression<char>::operator== .

When we link a program, the linker claims this
function is undefined in our library.

Solution:

We removed the "inline" keyword from file:
boost/regex/v3/regex_compile.hpp, line: 152

template <class charT, class traits, class Allocator>
/* removed: inline */ bool BOOST_REGEX_CALL
reg_expression<charT, traits,
Allocator>::operator==(const reg_expression<charT,
traits, Allocator>&
e)const
{
   return (_flags == e.flags())
           && (_expression_len == e._expression_len)
           && (std::memcmp(_expression, e._expression,
_expression_len *
sizeof(charT)) == 0);
}

Explanation:

The Solaris CC compiler mishandles inlines. Statements
such as (template<...> inline ...) can generate UNDEF
symbols in the object file, for functions that should
have been simply inlined.

Apparently each declared function is added to a table
of undefs, and deleted from it when it's defined - but
if the definition is inlined, the table entry remains.
This may not be a problem when linking a main program,
but it has prevented us from creating the shared
library.

Caution:

Generaly the inline keyword is unnecessary in template
statements, but it should be removed with caution. If
the template has no parameters
(template<> inline ...), removing the inline can cause
problems on windows platforms.

The MSVC6 compiler ignores the template<> keyword, so
in this case removing the inline keyword may generate
duplicate copies of the function in multiple
translation units.

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk