Boost logo

Boost Users :

From: Hughes, James (jhughes_at_[hidden])
Date: 2007-05-03 04:46:27


It appears that when I put BOOST_CLASS_EXPORT_GUID in class header
files, sometimes I get a Multiple definition error for the instance of
the guid_initializer, if the header file is included more than once in
various bits of code. If the GUID is place in the cpp file there are no
problems.

I can see why this happens, but the docs appear to imply I should be
able to put the definition in the header files, this paragraph below
(http://www.boost.org/libs/serialization/doc/serialization.html#pointero
perators)

"The macro BOOST_CLASS_EXPORT_GUID associates a string literal with a
class. In the above example we've used a string rendering of the class
name. If a object of such an "exported" class is serialized through a
pointer and is otherwise unregistered, the "export" string is included
in the archive. When the archive is later read, the string literal is
used to find the class which should be created by the serialization
library. ****This permits each class to be in a separate header file
along with its string identifier****. There is no need to maintain a
separate "pre-registration" of derived classes that might be serialized.
This method of registration is referred to as "key export". More
information on this topic is found in the section Class Traits - Export
Key."

Is the document misleading here, or have I missed something??

James

This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.


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