Re: [Boost-users] Serialization : unregistered_cast & otherquestions
Hello
I agree with you, and currently have the same comprehension of the
problem than you. I am currently also including BOOST_EXPORT_CLASS in
only one implementation file *per class*. This seems to work.
Robert is saying however, that even that can cause problem, but as
written on a previous message, I cannot manage to follow his advice on
including the archive headers in only one instantiation module (except
putting all serialization code into that module, which I did previously:
this is a maintenance nightmare, to the point that I ended up trying to
break my code into smaller places).
I'll chime in, as I'm having exactly the same issue, but on darwin/
gcc-4 with code in multiple dynamically loaded libraries... (I have
other issues too, I get to those later)
The problem is that although export.hpp is only included once per
generated .o file, there are multiple .o files all including the same
headers - and each therefore generates the same template
instantiations, thereby causing the multiple definitions during
linking. Also - the same headers may be included in multiple shared
libraries, exacerbating the problem with the same code instantiated
into multiple libraries - a serious problem if there are singletons.
I may not be understanding this correctly - here's what >I< think
needs to happen - please correct me.
For any derived class, there is a set of code (templates) that need
to be instantiated for each archive type (specifically, the list
boost::archive::detail::known_archive_types::type, for the templates
guid_initializer<T> and export_instantiate
participants (1)
-
RIVASSEAU Jean Noel