I just want to make sure that I understand the use of the Serialization
library’s EXPORT macros. On the “Serializable Concepts”
page of the documentation, it states:
--
The
macro BOOST_CLASS_EXPORT_GUID
associates a string literal
with a class. … This permits each class to be in a separate header file
along with its string identifier.
--
However, on the “Special Considerations” page, I
find:
--
Note
that the implementation of this functionality requires that the BOOST_CLASS_EXPORT
macro appear after and the inclusion of any
archive class headers for which code is to be instantiated. … Note that
including BOOST_CLASS_EXPORT
in the "a.hpp"
header itself as one would do with other serialization traits will make it
difficult or impossible to follow the rule above regarding inclusion of archive
headers before BOOST_CLASS_EXPORT
is invoked. This is different than
other serialization traits which would normally be included in same file as the
class declaration.
--
The associated example shows the EXPORT macro following the
#include of the header defining the class to be exported.
I would certainly much rather have the EXPORT macros appear
in the header with the class that defines them. I take it that means I
have to guarantee that the file actually responsible for operating on an archive
includes my headers with the class definitions and EXPORT macros *after*
including the appropriate archive headers (e.g., “boost/archive/xml_oarchive.hpp”).
Is that correct? Are there any other gotchas I should
be aware of if I place the EXPORT macros in the headers with the classes to be
exported?
Thanks,
Thomas Aylesworth
Senior Software Engineer
Reality Mobile