[boost][serialization] How to implement serialization classes in two DLLs
Hi,
After few hour on the subject, Im would like to have some explanations &
recommendations one the boost serialization library. To explain, my problem, you
will find hereafter a VC++ 7.1 project that demonstrates it.
Problem Description
We have involved in a large project with for example two DLLs libraries: LibA
and LibB. These libraries define & implement one class each other, lets say
libA::A and libB::B. These two classes can be serialized through boost
serialization engine.
The interfaces for the two classes are the same:
----------------------
struct LIBA_API A
{
std::vector<double> my_vector ;
private:
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()
};
LIBA_API
void save(const libA::A* pObj, std::ostream& os) ;
LIBA_API
void load(libA::A* &pObj, std::istream& is) ;
}; // Namespace libA
----------------------
The two free functions save() and load() are defined to be able to serialize the
class libA::A (respectively the class libB::B).
When, we try to use these interfaces in an EXE application:
----------------------
#include
participants (1)
-
jf332-3