I see how this would work. I would hope my method in the previous post would work as well. Robert Ramey Bill Lear wrote:
On Friday, January 7, 2005 at 10:58:13 (-0800) Robert Ramey writes:
... The whole concept behind BOOST_CLASS_EXPORT has been problematic for me for a couple of reasons. As a result, the confusion you cite is a real one.
I settled on the following that a friend suggested, which seems to work.
In my serialization/util.h file, I have the following:
template <class T> void save(const T* t, const std::string& filename) { ... }
template <class T> T* load(const std::string& filename) { ... }
at the bottom of this file, I have the following:
namespace dummy { struct bogus { static int bogus_method(); }; }
// force linking with util.cc static int bogus_variable = dummy::bogus::bogus_method();
in serialization/util.cc, I have:
#include
// expensive include which we wish to relegate to one one source file. #include
// the trigger method that forces others to link with this module int dummy::bogus::bogus_method() { return 0;}
The AllDerived.h file has includes for all my headers and all the BOOST_CLASS_EXPORT macros.
In my application code, I do this:
#include
#include and it all works flawlessly. I am spared from including the headers for my derived classes, and the accompanying export macros. The save and load routines work as expected.
Bill