
It SHOULD work but this is an area still in flux. You might expand on the explanation of how it fails: Some observations: There should be no need to include the header <boost/serialization/serialization.hpp> The serialization code will be instantiated only when code like ar << session_record is encountered. Since your DLL code doesn't include your any archives no code is generated. The first step to making this work is to look at the demo which compiles serialization code in separate modules. This shows how to instantiate the required code. Also look at polymorphic archives which permit application code to be compiled to a common interface. Good Luck Robert Ramey __PPS__ wrote:
is it possible to have this exported from dll:
///export.h///
#include <boost/serialization/serialization.hpp>
class session_record { virtual void print_on(std::ostream& os) const = 0; friend std::ostream & operator<<(std::ostream& os, const session_record& sr){ sr.print_on(os); return os; } public: friend class boost::serialization::access; virtual ~session_record(); template<class Archive> void serialize(Archive & ar, const unsigned int file_version){} operator session_record *(); };
void serialize(session_record* derived, const char* file_name); session_record* deserialize(const char* file_name);
///end of export.h///
and then in an application (linked to the dll that exports all from export.h) I create derived classes from session_record and serialize or deserialize them to/from files using the two exported free functions. I followed exactly steps in "Runtime Casting" of the manual, but it doesn't work. So... is it really runtime if it doesn't work this way - it only works if all the derived classes are known & registered at the time of compilation of the two functions. All that worked well if everything from export.h was linked statically, but not dynamically
Am I doing something wrong with all that stuff?? thanks