// Copyright David Abrahams 2006. Distributed under the Boost // Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include // ---- export.hpp ---- namespace boost { namespace serialization { struct tag {}; template int instantiate_serialize(int) { return 0; } template struct instantiator { // #define PROVE_THIS_GETS_INSTANTIATED to show that this class // #gets instantiated for each archive. # ifdef PROVE_THIS_GETS_INSTANTIATED typedef typename Serializable::nonexistent err; # endif typedef int instantiate; }; #define BOOST_SERIALIZATION_CLASS_EXPORT(C) \ namespace \ { \ int BOOST_PP_CAT(boost_serialization_instantiate_,__LINE__) \ = boost::serialization::instantiate_serialize(0); \ } #define BOOST_SERIALIZATION_DECLARE_ARCHIVE(A) \ namespace boost { namespace serialization \ { \ template \ typename instantiator::instantiate \ instantiate_serialize(...); \ }} }} // ------- some_archive.hpp --- namespace arch1 { struct myarchive1; } BOOST_SERIALIZATION_DECLARE_ARCHIVE(arch1::myarchive1) // ------- some_archive2.hpp --- namespace arch2 { struct myarchive2; } BOOST_SERIALIZATION_DECLARE_ARCHIVE(arch2::myarchive2) // ------- some_serializable_type.cpp ---- namespace user { struct my_serializable; BOOST_SERIALIZATION_CLASS_EXPORT(my_serializable) }