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

David Abrahams dave at boost-consulting.com
Mon Nov 3 21:33:47 CET 2003


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

> Raoul Gough <RaoulGough at yahoo.co.uk> writes:
>
> [snip]
>> 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)
> http://groups.google.com/groups?th=b462a38bc2c132f7
> http://groups.google.com/groups?th=2f0b2d7ab9a2485f
>
> 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.

We use lots of static data members, though; this isn't the only place
we ought to be seeing a problem if that's the issue.

However, a simple transformation ought to be enough to eliminate the
static data member, AFAICT.  Do you need help working it out?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list