$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Robert Ramey (ramey_at_[hidden])
Date: 2007-09-30 18:41:02
This is a question of instantiations.  If A.cpp doesn't refer to a specific archive (e.g. text_?archive) the
code won't be generated.  One way to do this for A.cpp is include the following at the end of the code:
  "Fred Lupien" <fred.lupien_at_[hidden]> wrote in message news:32e6d6bf0709301357md97df93pa65405cefcb2cd05_at_mail.gmail.com...
  Honestly I have been looking for a solution for hours before I made this post. I am not so familiar with boost, the only module I use is serialization so maybe my error is obvious but I went through all the doc on boost.org without luck.
  I should have been more descriptive I my first post. I does not work because I get unresolved externals on the base class save / load functions when I implement the derived class save/load functions. I am using the intrusive version of serialization so their should be no particular namespace requirement. Here is a simplified example of my problem: 
  ///////////////////////////////////// A.h
  Class A:
  {
      friend class boost::serialization::access;
      template<class Archive>
      void save(Archive & ar, const unsigned int version) const; 
      template<class Archive> 
      void load(Archive & ar, const unsigned int version);
      BOOST_SERIALIZATION_SPLIT_MEMBER()
  };
  /////////////////////////////////////
  ///////////////////////////////////// B.h
  class B: public A
  {
      friend class boost::serialization::access;
      template<class Archive> 
      void save(Archive & ar, const unsigned int version) const;
      
      template<class Archive>
      void load(Archive & ar, const unsigned int  file_version );
      BOOST_SERIALIZATION_SPLIT_MEMBER() 
  }
  BOOST_CLASS_EXPORT_GUID(B, "B")
  /////////////////////////////////////
  ///////////////////////////////////// A.cpp
  template<class Archive>
  void A::save(Archive & ar, const unsigned int version) const 
  {
      ar & var1;
  }
  template<class Archive>
  void A::load(Archive & ar, const unsigned int  file_version ) 
  {
      ar & var;
      somestuff();
  }  
  /////////////insert explicit instantiation for text archives /////////
  #include <boost/archive/text_iarchive.hpp> 
  #include <boost/archive/text_iarchive.hpp>
  template void A::load<boost::archive::text_iarchive>(boost::archive::text_iarchive & ar, const unsigned int  file_version );
  template void A::save<boost::archive::text_oarchive>(boost::archive::text_oarchive & ar, const unsigned int  file_version );
  /////////////////////////////////////