
This is possible and I have tested such a facility. I haven't had time to move the latest version into the trunk but one can find at www.rrsd.com However, in order to do this, you will have to know how to use EXPORT correctly which does require a close reading of the manual. Sorry about that. RObert Ramey Christian Widmer wrote:
Hi,
I'm trying to use boost to serialize a machine learning library that I'm working with. It all worked out very conveniently, but it seems now, that I have hit a dead end. I've been looking on the net but couldn't find any information that worked for me, so here we go:
The problem is, that the library consists of several modules, which are dynamically linked. For instance the class KernelMachine has a field kernel of type Kernel, which is contained in a separate module (in the sense of a shared object).
The following code compiles, but when I try to serialize a CKernelMachine object I get an "unregistered_class" error. (CKernel does serialize fine, when called directly)
class CKernelMachine : public CClassifier {
private:
friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & boost::serialization::base_object<CClassifier>(*this);
ar.register_type(static_cast
(NULL)); ar & kernel; std::cout << "done CKernelMachine" << std::endl; }
protected: CKernel* kernel; };
I found some threads that pointed me towards BOOST_CLASS_EXPORT, but I'm not exactly sure how to use it.
So my question is - is it in principle even possible to serialize across module (shared-object) boundaries.
If so, how should I go about? Any pointers would be greatly appreciated.
- Chris