I've updated the advice on using BOOST_CLASS_EXPORT. The new
advice is described in the documentation in the trunk. This will require
moving some
macros between source modules (*.cpp and *.hpp files).
In exchange, you'll get
a) a more carefully thought out way to handle exports.
b) the ability to include serialization code in DLLS with little or no
suprises.
c) serialization code will be thread safe - without any locking required.
Robert,
I've read the new documentation and while it fixes the compilation
errors, I still get runtime unregistered_class exceptions. Here's my
general setup, briefly.
MyClass.h
-------
class MyClass : public SomeBase { .... };
MyClassSZ.h
---------
#include
template<Archive>
void serialize( Archive&, MyClass&, ... )
ClassSZ.cpp
-----------
#include
#include // All archive types I'm going to use
#include
BOOST_CLASS_EXPORT(MyClass);
void serialize( Archive&, MyClass&, unsigned int )
{
// perform serialization. No void_cast_register is done
// because I *always* serialize via a base class pointer.
// also, I do not serialize the base object as there is
// no data in it.
}
// Explicitly instantiate above function for each archive type
template
void serialize(xml_iarchive&, MyClass&, unsigned int);
template
void serialize(xml_iarchive&, MyClass&, unsigned int);
// ... etc.
----------------------------------------
All of my ClassSZ.cpp files are compiled and statically linked into a
library. Then, in the application:
main.cpp
--------
#include ... // archive type that I want
#include
// Create archive and serialize a MyClass via SomeBase ptr)
----------------------------------------
Is it a possibility that the linker is not linking in the
guid_initializer code? For this particular build type, I'm not even
doing optimizations... let alone link-time code generation. This is on
MSVC80.
Thanks,
Dan