[C++-sig] boost::python::range and duplicate comdat under MSVC 6

Raoul Gough RaoulGough at yahoo.co.uk
Fri Oct 31 15:56:31 CET 2003


Thanks once again to Ralf, I'm working with indexing_v2 under MSVC6. I
have succeeded in compiling one of the test programs (testnonlinear)
but in the process noticed a bug that seems to crop up whenever a
module defines two or more instances of boost::python::range with the
same call policies. It results in a link-time error like the
following:

iterator.obj : fatal error LNK1179: invalid or corrupt file: duplicate comdat
"?registration@?$shared_ptr_from_python at U?$iterator_range at U?$return_value_policy at Ureturn_by_value@python at boost@@$D"

Neither dumpbin nor undname make any sense of the identifier, and I
haven't tracked down where the symbol is getting defined. I can only
think that there's a template getting instantiated without the
iterator_range template arguments, and therefore comes out as the same
"decorated" symbol in all cases...  Any ideas what's really going on
here?

Demo program (heavily edited libs/python/test/iterator.cpp)

-------8<-------------------
#include <boost/python/module.hpp>
#include <boost/python/class.hpp>
#include <boost/python/iterator.hpp>
#include <list>

typedef std::list<int> list_int;
typedef std::list<double> list_double;

list_int::iterator begin_list_int (list_int& x) { return x.begin(); }
list_int::iterator end_list_int (list_int& x) { return x.end(); }
list_double::iterator begin_list_double (list_double& x) { return x.begin(); }
list_double::iterator end_list_double (list_double& x) { return x.end(); }

BOOST_PYTHON_MODULE(iterator_ext)
{
  using namespace boost::python;

  class_<list_int>("list_int")
    .def("__iter__", range (&begin_list_int, &end_list_int))
    ;

  class_<list_double>("list_double")
    .def("__iter__", range (begin_list_double, end_list_double))
    ;
}
-------8<-------------------

-- 
Raoul Gough.
(setq dabbrev-case-fold-search nil)





More information about the Cplusplus-sig mailing list