[serialization] BOOST_CLASS_EXPORT

Hello, I am using the CVS version tagged RC_1_34_0. I put all the BOOST_CLASS_EXPORT statements into a header file that also contains all the serialization functions. This header is included by two separate .cpp files, each of which implements the loading and saving of archives for a different subset of the classes that can be serialized. These are all compiled into a single DLL. All of this compiles under VC8.0 (but I have not yet verified that it runs properly). But when linking with gcc (in Linux), I get multiple definition errors when linking. What's the best way to deal with this? (assuming that this is a problem that you recognize and know how to fix) Deane

Method I Make your function "inline" either explicitly or by including the definition in the member function declaration. This is not my favorite method. leave the declarations in the header - but move the definitions to a *.cpp file. Use explicit instantiation to generate code for all the archives you plan to use or for polymorphic archive. This is my preferred method. Robert Ramey Deane Yang wrote:
Hello,
I am using the CVS version tagged RC_1_34_0.
I put all the BOOST_CLASS_EXPORT statements into a header file that also contains all the serialization functions. This header is included by two separate .cpp files, each of which implements the loading and saving of archives for a different subset of the classes that can be serialized.
These are all compiled into a single DLL.
All of this compiles under VC8.0 (but I have not yet verified that it runs properly).
But when linking with gcc (in Linux), I get multiple definition errors when linking.
What's the best way to deal with this? (assuming that this is a problem that you recognize and know how to fix)
Deane
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Deane Yang
-
Robert Ramey