Hmm - I'm not sure which version of boost you're using.
 
For boost version 1.32 one needs to use
 

BOOST_SHARED_POINTER_EXPORT(T)

This requirement was eliminated in 1.33 onward but I'm not sure which version you're using.

 

Robert Ramey

"Sohail Somani" <s.somani@fincad.com> wrote in message news:1C1EBEF8DBACDC439D038EA051674EC73EE10C@xbox.financialcad.com...

Nope, same thing. Is there a way to enable some debug traces of the serialization? Inspection by debugging isn't helping much. What does the serialization library do differently for abstract classes? The part that is still confusing me is that I only have these issues when serializing shared_ptr. Raw pointers work just fine.

-----Original Message-----
From: boost-users-bounces@lists.boost.org on behalf of Robert Ramey
Sent: Tue 3/27/2007 10:28 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [serialization] Assertion`new_cid==cid'failed-fails on gcc, works on msvc

OK

Try the following:

//BOOST_CLASS_EXPORT(base);

BOOST_CLASS_EXPORT(derived);

#include <boost/serialization/shared_ptr.hpp>

//BOOST_SERIALIZATION_SHARED_PTR(base);

BOOST_SERIALIZATION_SHARED_PTR(derived);

The base class shouldn't need exporting as it never

directly instantiated.


Robert Ramey


Sohail Somani wrote:
>> -----Original Message-----
>> From: boost-users-bounces@lists.boost.org
>> [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert
>> Ramey Sent: Tuesday, March 27, 2007 2:39 PM
>> To: boost-users@lists.boost.org
>> Subject: Re: [Boost-users] [serialization] Assertion `new_cid
>> ==cid'failed-fails on gcc, works on msvc
>>
>> Note that serialize a poly morphic shared pointer requires a little
>> bit of gymnastics.  Check out the "test_shared_ptr" and the
>> source of serialization/shared_ptr.hpp
>
> I think I've followed the documentation, but the attached test still
> triggers an assertion when deserializing on gcc 3.2.2:
>
> $ ./build/stage/bin/test_serialize
> Serialized form: 22 serialization::archive 3 0 1 2 7 derived 1 0
> 0 1 0
> 1 10 derived id
> test_serialize: basic_iarchive.cpp:466: const
> boost::archive::detail::basic_pointer_iserializer*
> boost::archive::detail::basic_iarchive_impl::load_pointer(boost::archive
>>> detail::basic_iarchive&, void*&, const
> boost::archive::detail::basic_pointer_iserializer*, const
> boost::archive::detail::basic_pointer_iserializer*(*)(const
> boost::serialization::extended_type_info&)): Assertion `new_cid ==
> cid' failed.
> Aborted
>
> This assertion does not trigger occur on Visual C++ 7.1. Can you spot
> if I'm doing something obviously silly?


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users