|
Boost Users : |
Subject: Re: [Boost-users] [serialization] Export question
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-04-08 13:19:49
"Tom Aylesworth" <taylesworth_at_[hidden]> wrote in message
news:0D75E0E38A78ED40B5933CCBB98119F3900F5CDABF_at_hermes.realitymobile.local...
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. *** Hmmm - my current copy of the documentation doesn't include the above statement. It shouldn't be there now. I'll double check. 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 above is correct. The associated example shows the EXPORT macro following the #include of the header defining the class to be exported. **** hmmm - which example? 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? **** my advice: a) Don't put EXPORT macro in headers. b) Add a small module to your main code which looks like #include archive .... // repeat as necessary #include "a.hpp" BOOST_CLASS_EXPORT(A) .... // repeat as necessary for each class defined in the main line c) for each DLL - do the same thing for classes defined in the DLL. Robert Ramey Thanks, Thomas Aylesworth Senior Software Engineer Reality Mobile _______________________________________________ Boost-users mailing list Boost-users_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/boost-users
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