Boost logo

Boost Users :

From: jono (jp_at_[hidden])
Date: 2008-03-02 15:49:16


hi,

i've received this error compiling a project under visual studio 7.1.

"fatal error C1128: object file format limit exceeded : more than 65,279
sections"

the problem appeared when i added a couple more specializations to a
'binary operator' visitor for manipulating boost variant objects.

before this, there were 20 or 30 similar specializations compiling
without errors or warnings.

the visitor and helpers are as follows:

===========================
template<BinaryOp op, typename ObjectT, typename ObjectU>
Object binary_op(const ObjectT &arg1, const ObjectU &arg2)
{
     return undefined;
}

template<BinaryOp op, typename ObjectT>
Object binary_op(const ObjectT &arg1)
{
     return undefined;
}

template<BinaryOp op>
class BinaryOpVisitor : public boost::static_visitor<Object>
{
public:

  template<typename ObjectT>
  Object operator()( const ObjectT &arg0) const;
  {
   return binary_op<op, ObjectT>(arg0);
  }

  template<typename ObjectT, typename ObjectU>
  Object operator()( const ObjectT &arg0, const ObjectU &arg1) const
  {
   return binary_op<op, ObjectT, ObjectU>(arg0, arg1);
  }
};

========================
and specialized:
========================

template<> INLINE Object binary_op<ADD>(const Integer& arg0, const
Integer& arg1){return make<Integer>(arg0 + arg1);}
....
....
....
.... etc etc

========================
the variant type looks like this....
========================

typedef boost::make_recursive_variant<
         Nil
        ,Integer
        ,Real
        ,String
        ,Error
        ,Class
        ,Character
        ,Stream
        ,Boolean
        ,boost::recursive_wrapper< Symbol >
        ,boost::recursive_wrapper< Lambda >
        ,boost::recursive_wrapper< Function >
        ,boost::recursive_wrapper< Pair >
>::type Atom;

========================

i imagine there are some combinatorial proliferations of template
instantiation going on in the compiler.

the operators were declared inline, but removing that didn't fix the error.

i've restructured the source code in other ways, but without success so far.

visual studio 8 has a compiler switch /bigobj to resolve this problem:

"By default, an object file can hold up to 65,536 (2^16) addressable
sections. /bigobj increases that address capacity to 4,294,967,296 (2^32)."

i haven't tried compiling this project with g++ since making these
changes (haven't checked them in) so i don't know what its limits are.

does anyone has experience with solving this problem. is it a problem
with my visitor class? is there a way i can break my recursive variant
down for the compiler?

cheers,
Jono Poff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net