Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2007-11-04 21:29:02


Hi,

I was able to make this work on serialization after some minor modifications:
PS: pseudo-code

DLL1:
header.h
BOOST_IS_ABSTRACT(base);
class base
{
  virtual ~base() {}
 // serialization
};
source.cpp
class derived : base
{
  // serialization
};
BOOST_CLASS_EXPORT(derived);

void serialize(oarchive& ar)
{
  boost::shared_ptr<derived> p(new derived);
  ar << p;
}

DLL2:
std::stringstream stm;

{
  oarchive oar(stm);
  serialize(oar);
}

{
  iarchive iar(stm);
  boost::shared_ptr<base> p;
  iar >> p; // deserializing a derived class defined in DLL1 in DLL2
}

I had to compile serialization as a lib. And making tk_map and kt_map
global objects (not sure if this is necessary though), removing the
assertion about multiple inserts in static insert function of both
[kt][tk]_map's and commenting
line 315 of basic_oarchive:
//if((cobject_info_set.size() > original_count)){
+{

I don't know the internals of serialization enough to say this is
anything near correct. And I'll still need to test more, which I will
do, since I need this functionality very much.

Regards,

-- 
Felipe Magno de Almeida

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk