|
Boost Users : |
From: Christian Widmer (cwidmer_at_[hidden])
Date: 2008-02-27 11:04:58
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<CGaussianKernel *>(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
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