Boost logo

Boost Users :

From: Jerry (jerry_at_[hidden])
Date: 2008-03-11 16:17:13


Jeff, thanks.

> Look for the BOOST_...EXPORT macros, but they're still not automatic.

Yep, that does it. Certainly automatic enough.

For anyone searching the archives I think this is the archetype:

//---------header file-----------

// example derived serializable class
class derived : public base
{
    std::string m_name;
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive &ar, const unsigned int /*version*/)
   {
        // serialize base class
        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(base);
        // handle any members in derived
        ar & BOOST_SERIALIZATION_NVP(m_name);
   }
   public:
   derived() {}
};

// ensure correct ID generation when saving via base*
// if this is omitted you'll get an unregistered exception unless
// you register each class directly with the archive
BOOST_CLASS_EXPORT_GUID(derived,"derived")

//---------/header file-----------


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