Opened 7 years ago
Closed 7 years ago
#11593 closed Feature Requests (invalid)
undocumented export problem
Reported by: | Owned by: | Robert Ramey | |
---|---|---|---|
Milestone: | To Be Determined | Component: | serialization |
Version: | Boost 1.58.0 | Severity: | Cosmetic |
Keywords: | serialization | Cc: |
Description
when I started using the serialisation I had a problem with duplicated symbols being produced by BOOST_CLASS_EXPORT_GUID called twice from different compilation units. I have not used the macro as said in tutorial in the definition of class but thought the .h file will be a better place for it.
I think it would be great if either one of those would happen:
- the problem with duplicated guid if the BOOST_CLASS_EXPORT_GUID is called twice from different CU
- the prevention mechanism would be incorporated in macro (for instance if the guid is registered with a same class, second macro is expanded into nothing)
If the 2nd option is impossible if the documentation would explicitly say that such code: duplicate symbol ZN5boost7archive6detail12extra_detail9init_guid is the result of registering class twice it could save some time with investigation.
The use of BOOST_CLASS_EXPORT is no longer recommended.
Use BOOST_CLASS_EXPORT_KEY and BOOST_CLASS_EXPORT_IMPLEMENT instead. These were invented specifically to address this problem. It's in the documentation.