
[Boost.Serialization] Derived class de-serialization problem due to MSVC linkerThe problem is this: When I de-serialize a DerivedObject to a BaseObject-pointer (so that only the header of the BaseObject class is included) the linker seems to throw away the information from the explicit template instantiation of the DerivedObject in some cases. When I combine the explicit template instantiation and definition of serialize into one object for BaseObject and all DerivedObject, the linker keeps the registration information of the derived class (because MSVC uses object-level linking). Due to the coding standards in our institution this method was disapproved. Is there a way to make the linker keep the registration information of DerivedObject? *** Generally, the linker will discard any code not explicitly referred to. This is addressed by EXPORT which is non-standard and compiler dependent and "too clever". So it's not 100% relieable in all cases. My personal recomendation would be to create a small module which just refers to all your derived classes and link that in. But that would likely violate your organizations coding standards. I don't see a way to do this without changing you're organizations coding standards. Robert Ramey