
I am trying to use the boost serialization library to save an objects from a class heiarchy. I keep running into a stream error when deserializing a pointer from an xml archive. I have everything registered (that took a while, but I have that problem figured out, I think), and the serialization to an xml archive seems to work just fine. I have stepped through the deep nesting of calls to the exception and it is being thrown because the stream says it is bad when trying to read the end tag. I also tried it with text archives, and I get the same problem. I have done the obvious (to me at least) things such as class export/registration, us std::ios::binary for output/input stream instances. Any advice on how to track down this problem with a stream error? I have gone back to first principles with a simple example and that all seems to work. So it is obviously user error. I am trying to understand what is wrong with my more involved case. I appreciate any advice someone could give me.) Thanks, Phil

pwm wrote:
I am trying to use the boost serialization library to save an objects from a class heiarchy. I keep running into a stream error when deserializing a pointer from an xml archive. I have everything registered (that took a while, but I have that problem figured out, I think), and the serialization to an xml archive seems to work just fine. I have stepped through the deep nesting of calls to the exception and it is being thrown because the stream says it is bad when trying to read the end tag.
This would normally be due the asymettric serialization where one does: ar << a and later ar >> a; ar >> b; // uh-oh - read end tag - now its gone Robert Ramey

Robert Ramey wrote:
This would normally be due the asymettric serialization where one does:
Thanks for the reply. I have checked and I do not think I am making that error. So ... I am in the process of starting from scratch, and now that is giving me problems. I am starting with the shared_ptr example (I am using 1.33.1 with VC 8 sp1) and that works fine for text archive (after I comment out the register_type calls for boost::detail::sp_counted_base_impl). But when I replace all text archives with xml archives and update all serialization calls with BOOST_SERIALIZATION_NVP, I still get the static assert error that says I need to wrap with make_nvp. Any suggestions on how to get the shared_ptr example working with xml archives? Thanks, Phil P.S. I would try using the head or a stable point in CVS, but I cannot access the boost cvs repository. Is there a place where I can download a zip of 1.34?

I modified demo_shared_ptr to use NVP. It compiled, linked and ran with no warnings or errors of any kind. I'm using the HEAD version and their are significant differences with shared pointer serialization, but I don't know if that is what's different. Robert Ramey pwm wrote:
Robert Ramey wrote:
This would normally be due the asymettric serialization where one does:
Thanks for the reply. I have checked and I do not think I am making that error. So ... I am in the process of starting from scratch, and now that is giving me problems.
I am starting with the shared_ptr example (I am using 1.33.1 with VC 8 sp1) and that works fine for text archive (after I comment out the register_type calls for boost::detail::sp_counted_base_impl).
But when I replace all text archives with xml archives and update all serialization calls with BOOST_SERIALIZATION_NVP, I still get the static assert error that says I need to wrap with make_nvp. Any suggestions on how to get the shared_ptr example working with xml archives?
Thanks, Phil
P.S. I would try using the head or a stable point in CVS, but I cannot access the boost cvs repository. Is there a place where I can download a zip of 1.34?
begin 666 test_zmisc.cpp
M+R\@9&5M;U]S:&%R961?<'1R+F-P<" Z(&1E;6]N

Robert Ramey wrote:
I modified demo_shared_ptr to use NVP. It compiled, linked and ran with no warnings or errors of any kind.
I'm using the HEAD version and their are significant differences with shared pointer serialization, but I don't know if that is what's different. Robert, First of all---thank you for your help and for all of your work to develop and support this wonderful serialization library.
I have narrowed down my problem---I think it is a general problem with the 1.33.1 serialization library with xml archives and VC8. I have reproduced the problem by modifying demo_shared_ptr.cpp to use xml archives rather than text archives. The class registration for type B fails. That is, I modified the original regsitrations (in the addition by DT section of main), which were using the old implementation details of shared ptr to be oa.register_type<A>( static_cast( NULL ) ); oa.register_type<B>( static_cast( NULL ) ); This compiles and works fine for text archives, but fails to compile with xml archives with the static assert error that an nvp wrapper has not be used. In your modified demo_shared_ptr example, are you using xml archives too?
P.S. I would try using the head or a stable point in CVS, but I cannot access the boost cvs repository. Is there a place where I can download a zip of 1.34?
Is there any way I can get a zip copy of the HEAD of boost? Thanks, Phil

----- Mensaje original -----
De: pwm
Is there any way I can get a zip copy of the HEAD of boost?
Daily snapshot of the HEAD branch of CVS: http://www.boost-consulting.com/boost.tar.bz2 Daily (or even more frequent) snapshot of the RC_1_34_0 branch: http://engineering.meta-comm.com/boost/snapshot/boost- RC_1_34_0.tar.bz2 HTH, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Robert Ramey wrote:
Note that in my last email on this thread, I attached my modified copy of the demo. You should try to compile that.
Sorry, I did not recognize that. I am using Thunderbird on Windows XP and the attachment simply shows up in the newsreader as below. Is there a way to get an unencoded copy of this test program? By the way, now that Joaquín pointed me to http://engineering.meta-comm.com/boost.aspx I will try out the HEAD and let you know. Thanks! (I had to quote the attachment snippet cause the mail server rejected this small snippet the first time as a corrupt attachment.)
begin 666 test_zmisc.cpp M+R\@9&5M;U]S:&%R961?<'1R+F-P<" Z(&1E;6]N
participants (3)
-
"JOAQUIN LOPEZ MU?Z"
-
pwm
-
Robert Ramey