Boost logo

Boost Users :

From: Jim Lear (jim.lear_at_[hidden])
Date: 2005-01-07 15:28:50

Gee.  I didn't know you subscribed to the Boost list.  I guess you saw my "I'm a newbie and can't find my ass" posting a while back.

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

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
  static int bogus_variable = dummy::bogus::bogus_method();

in serialization/, I have:

  #include <serialization/util.h>

  // expensive include which we wish to relegate to one one source file.
  #include <AllDerived.h>

  // 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

In my application code, I do this:

  #include <Base.h>
  #include <serialization/util.h>

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.

Boost-users mailing list


Jim Lear

This document/email may contain confidential, proprietary or privileged
information and is intended only for use of the addressee/recipient named
above. No confidentiality or privilege is waived or lost by any error in
transmission of this document/email.  If you are not the intended recipient
of this document/email of Legerity, Inc., you are hereby notified that you
must not use, disseminate, or copy it in any form or take any action in
reliance on it.

If you have received this document/email in error, please immediately
notify me at (512) 228-5760 and permanently destroy/delete the original
document/email and any copy of the document/email and printout thereof.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at