[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

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

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

#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(); }

  using namespace boost::python;

    .def("__iter__", range (&begin_list_int, &end_list_int))

    .def("__iter__", range (begin_list_double, end_list_double))

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

More information about the Cplusplus-sig mailing list