Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] boost::system::error_category
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2009-08-12 07:32:07


Rutger ter Borg wrote:
[snip]
> Any suggestions on how to approach this?

Sorry to be replying to myself, but being a couple of hours further down the
road, I think I made little progress. I thought I could approach the
serialization of a polymorphic singleton basically by saving its
(polymorphic) pointer, and loading it back by overloading the load_construct
data and assign the singleton object there.

Unfortunately, I am dealing with an abstract base class (error_category)
which is declared in boost/system/error_code.hpp. The definition and
implementation of error_category singleton objects are not visible in the
header files of the Boost.System library; it resides in the binary library
file only.

Which leaves me with an unregistered class. I'm unable to register it
(because I can not access its definition), I tried to use forward
declarations and export those, but that didn't work, too. I tried to export
the base and derived relationship, without success, too.

My next step would be to bypass serialization facilities and implement
something like below

save( ... ) {
  ar << category.name();
}

load( ... ) {
  std::string name;
  ar >> name;
  if ( name == ... ) {
  }
}

Is there a way to register type information that is not seen yet by the
serialization library (i.e., it will be linked in)? Is there a way to export
classes that reside in a DLL?

Thanks in advance,
Kind regards,

Rutger ter Borg


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