My application that works with 1.32 is failing to link with 1.33 RC1 due
to boost::serialization::void_cast_register (specialised for my classes)
being an unresolved external.
In my case the void_cast_register call and the BOOST_CLASS_EXPORT macro
are in one module while the serialization is done in another module,
with all modules linked in one application.
The code below also shows this problem, however if I add an archive
class and header to the example then it will compile and link ok.
Obviously this is when serialization is in the same module as the
void_cast_register call.
Any suggestions about what I need to add to make the application link?
Richard
************************************************************************
*******
#pragma hdrstop
#include
#include
#include
#pragma link "libboost_serialization-bcb-mt-d-1_33.lib"
class Z
{
public:
virtual void DoSomething() =0;
};
BOOST_IS_ABSTRACT(Z)
class A : public Z
{
public:
void DoSomething(){};
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned intversion)
{
ar & boost::serialization::make_nvp("A", m_A);
}
int m_A;
};
class B : public Z
{
public:
void DoSomething(){};
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned intversion)
{
ar & boost::serialization::make_nvp("B", m_B);
}
int m_B;
};
BOOST_CLASS_EXPORT(A)
BOOST_CLASS_EXPORT(B)
int main(int argc, char* argv[])
{
boost::serialization::void_cast_register(0,0);
boost::serialization::void_cast_register(0,0);
return 0;
}
Errors:
[Linker Error] Unresolved external 'const
boost::serialization::void_cast_detail::void_caster&
boost::serialization::void_cast_register(const A *, const Z *)'
referenced from D:\PROJECTS\...\SOURCE\TEST\BUILD\MAIN.OBJ
[Linker Error] Unresolved external 'const
boost::serialization::void_cast_detail::void_caster&
boost::serialization::void_cast_register(const B *, const Z *)'
referenced from D:\PROJECTS\...\SOURCE\TEST\BUILD\MAIN.OBJ