Boost logo

Boost :

Subject: Re: [boost] [serialization] Can one deserialize a derived classes viapointers to the base class using polymorphic archives in aDLL context?
From: Bogdan (bogdan.indy_at_[hidden])
Date: 2010-02-13 13:04:57

Robert Ramey <ramey <at>> writes:

> >>
> >> Please note BOOST_CLASS_EXPORT_IMPLEMENT is used only once per class
> >> (inside polymorphic_derived2.cpp), yet the serializers are inserted
> >> in the same map both from the Dll and from the executable.
> >>
> >> Am I doing something wrong? Has anyone been able to create a similar
> >> working example? I really appreciate any feedback I could get.
> It looks like polymorphic_derived2.cpp is being included in both the
> mainline as well as the DLL.
> It's not clear that polymorphic_base needs to be n the DLL and probably
> shouldn't be.
> Make sure that your header includes BOOST_CLASS_EXPORT_KEY and not
> finally, make sure that the test for this facility works.
> Robert Ramey

Thank you Robert for your quick response: I appreciate a lot the generous
work you put in the library.

I double checked the project I previously uploaded: I downloaded it via, changed the name back from bin to zip and verified the following:

- polymorphic_derived2.cpp file is included only in

- there are only three projects dll_polymorphic_derived2, Library and
test_dll_exported plus an explicit reference to the bjam files (I removed
the latter after downloading);

- there is no usage BOOST_CLASS_EXPORT;

- there are exactly three declarations of BOOST_CLASS_EXPORT_KEY: one in
polymorphic_base.hpp, and two in polymorphic_derved2.hpp one for
polymorphic_derived1 and another for polymorphic_derived2. Similarly, there
are only three usages of BOOST_CLASS_EXPORT_IMPLEMENT.

There was only one question mark: test_dll_exported.vcproj depended on
dll_polymorphic_derived2 both via Project Dependencies option and explicitly
as an input library: to be on the safe side, I removed the explicit
dependency of test_dll_exported on dll_polymorphic_derived2 from the

I rebuild the solution from scratch. Unfortunately I got the same exception.
So I am still cornered and looking for some help.

Thank you again,


Boost list run by bdawes at, gregod at, cpdaniel at, john at