Hello and thanks for the help I received so far.
here is my current problem:
The class I try to serialize is:
class LIBPALO_NG_CLASS_EXPORT CubeCache : public CUBE_INFO {
public:
friend class boost::serialization::access;
CubeCache();
~CubeCache();
void setSequenceNumber( unsigned int sequenceNumber ) {
m_SequenceNumber = sequenceNumber;
}
unsigned int getSequenceNumber() const {
return m_SequenceNumber;
}
private:
unsigned int m_SequenceNumber;
template<class Archive>
void serialize( Archive &ar, const unsigned int version );
};
the cpp file looks as follows:
#include "CubeCache.h"
#include <boost/serialization/base_object.hpp>
namespace jedox {
namespace palo /* palo */
{
template<class Archive>
void CubeCache::serialize( Archive &ar, const unsigned int version ) {
// save/load base class information
ar & boost::serialization::base_object<CUBE_INFO>( *this );
ar & m_SequenceNumber;
}
CubeCache::CubeCache(){;}
CubeCache::~CubeCache(){;}
}
} /* jedox */
The CUBE_INFO structure serializes just fine. There are no linkage problems with the following code:
int main( int argc, char* argv[] ) {
CUBE_iNFO* const c = new CUBE_INFO();
std::ofstream ofs("filename");
// save data to archive
{
boost::archive::text_oarchive oa( ofs );
// write class instance to archive
oa << ( c );
// archive and stream closed when destructors are called
}
return 0;
}//////////////////// add this here - explicite instantiationtemplate CubeCache::serialize<boost::archive::text_oarchive>;
However, when I use CubeCache instead of CUBE_INFO in the above code, i get a linkage error:
======================================================================
libpalo_ng.obj : error LNK2019: unresolved external symbol "private: void __thiscall jedox::palo::CubeCache::serialize<class boost::archive::text_oarchive>(class boost::archive::text_oarchive &,unsigned int)" ...
======================================================================
There are no linkage problems with the library when i do not use boost::serialization. I guess this happens
when the linker tries to link with the serialization library. LIBPALO_NG_CLASS_EXPORT is defined as:
# define LIBPALO_NG_CLASS_EXPORT __declspec(dllexport)
Regards, Oliver
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users