Boost logo

Boost Users :

From: Andrzej Cieslar (carbonmonoxide_at_[hidden])
Date: 2004-10-22 02:55:49


Hello,

I'm having some problems trying to use the boost::serialization
library. Here's why:

I have a class hierarchy (~80 classes). I was trying to add the
serialization abilities to the entire hierarchy (intrusive
template-based version). Because I need to serialize things
through pointers to base classes, I do the register_type on each
class. But the compilation fails on MSVC 7.1 with "internal
structure overflow" and "out of keys" errors. So I googled a
little bit and found out that this is a known issue with MSVC
and that the workaround is to split the .cpp file into smaller
parts. So I did. But now the linker fails due to excessive .lib
file size (I had to put the register_type function for each
class in separate .cpp file)

Ok so I switched to the polymorphic archives. It compiles fine,
but fails at runtime when saving a null pointer.
Here's a short example:

---
#include <fstream>
#include <boost/archive/polymorphic_text_oarchive.hpp>
struct A
{
   void serialize(
      boost::archive::polymorphic_oarchive & ar,
      const unsigned int version)
   {}
};
int main(int argc, char* argv[])
{
   std::ofstream ofs("serialized.txt");
   boost::archive::polymorphic_text_oarchive oa(ofs);
   A* a = 0;
   oa << a;
}
---
The failure is because of trying to dynamic_cast from 
interface_oarchive& to basic_oarchive&, which I believe are not 
related:
oserializer.hpp, l.422:
if(NULL == t){
   basic_oarchive & boa = 
boost::smart_cast_reference<basic_oarchive &>(ar);
Are these known issues or am I missing something?
I'd be grateful for your help
All best,
Andrzej Cieslar
----------------------------------------------------
Pistolety wiatrówki bez zezwolenia w Militaria.pl 
Teraz do 30% taniej!
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fsklep1.html&sid=260

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