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

Raoul Gough RaoulGough at yahoo.co.uk
Mon Nov 3 13:06:48 CET 2003

Raoul Gough <RaoulGough at yahoo.co.uk> writes:

> 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"

I have some more information about this problem (which, if I didn't
make it clear before, does *not* depend on the indexing_v2 code). It
seems to be a genuine MSVC6 bug to do with static member variables of
templates, and AFAICT is casued by an _atexit handler that the
compiler generates whether or not the static object has a non-trivial
destructor. I'm pretty sure it is the same problem reported in a few
2000/2001-vintage usenet postings to microsoft.public.vc.*:

http://groups.google.com/groups?th=8a05c82c4ffee280 (look for P78)

In our case it's being triggered by the static member variable in
shared_ptr_from_python (see coverter/shared_ptr_from_python.hpp).
Seems pretty fatal to me, since (AFAIK) a static object is necessary
for the type registration scheme to work. I'm not going to bother
trying to fix this.

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

More information about the Cplusplus-sig mailing list