Boost logo

Boost Users :

From: RIVASSEAU Jean Noel (JN.RIVASSEAU_at_[hidden])
Date: 2006-02-28 05:25:21


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<T, archive_list>)
 From what I see, these are NOT declarations required by the other
serialization code, but singletons that, during construction,
register the serializers to the derived classes with the
extended_type_info class registry. Is that incorrect?

If the above is correct, then the BOOST_EXPORT_CLASS should only be
in exactly one implementation file (.cpp, .C, .cc, whatever). And
also, THAT implementation file should ONLY be linked into one shared
library.

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net