
Why don't you look at export.hpp and compile and link test_inclusion and tell me what I'm missing?
export.hpp includes many boost headers, then defines the templates that BOOST_CLASS_EXPORT instantiates, and finally defines BOOST_CLASS_EXPORT itself. Any header that calls BOOST_CLASS_EXPORT is physically coupled with boost serialization, as well as with other boost components. My guess is that you're telling me that one can simply not define the templates that specify how a particular class is serialized (only provide declarations) and later use explicit template instantiation to make the compiler generate the instances that are needed. However if you use BOOST_CLASS_EXPORT, your classes are physically coupled with boots serialization and with boost in general. Beyond that, any project that includes a header that uses BOOST_CLASS_EXPORT will link the template instances generated by BOOST_CLASS_EXPORT, even if no call to boost serialization is ever made. Compare this to the example I provided a few levels up: foo.h does not include any header files and yet defines how objects of class foo are to be serialized. Correct me if I'm wrong but I think that that example is essentially compatible with boost serialization; it is the intended use of BOOST_CLASS_EXPORT in header files that introduces the physical coupling I'm complaining about. Or am I missing something still? :)