Boost logo

Boost Users :

From: Jerry (jerry_at_[hidden])
Date: 2008-03-23 10:33:40


Robert,

> Note that results should be the same with all types of archives. This is a fundamental goal of the library. So if you can make an example which > fails with binary archive but passes with another one - that would be of interest.

It is a header ordering issue.

I instrumented the insert and tfind functions in basic_serializer_map.cpp such that they spewed some debug e.g.

basic_serializer_map.cpp(53) : this: 00575BB0: Registering CDiagramButton -> true
basic_serializer_map.cpp(82) : this: 00575BB0: tfind() CDiagramButton -> true
basic_serializer_map.cpp(82) : this: 00575BF4: tfind() CDiagramButton -> false

i.e. the first case was registering with one map, the second case was failing to find the type in another map.

The failing case above had the following #include order

#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>

#include <boost/serialization/export.hpp> // <-- wrong! move it

#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>

#include "test_classes.h"

I now realise that <boost/serialization/export.hpp> now needs to follow any of the archive headers. The #include order determines which failure will occur - something that might be added to the comments in the code. Is there any way to detect this problem at compile /link time?

Thanks.

Jerry.
  ----- Original Message -----
  From: Robert Ramey
  To: boost-users_at_[hidden]
  Sent: Friday, March 21, 2008 5:15 PM
  Subject: Re: [Boost-users] serialization & registration questions

  Note that results should be the same with all types of archives. This is a fundamental goal of the library. So if you can make an example which fails with binary archive but passes with another one - that would be of interest.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net