|
Boost Users : |
Subject: Re: [Boost-users] [serialization] Polymorphic serialization with polymorphic archives problem...
From: dada_at_[hidden]
Date: 2010-02-21 03:56:12
Hi,
I have the same scenario, and it's not a problem.
If i understand (my english is poor, sorry) well.
But there is differences:
- I use GCC compilers (but boost is portable).
- I use static linking.
Probably this differences should not have consequences on the result.
I didn't read your code... Had you follow this rules ?
- Register child class (a simple way is using the BOOST_CLASS_EXPORT macro).
- In the serialize method of your child class, call the
serialization of parent's class (optional). I use
BOOST_SERIALIZATION_BASE_OBJECT's macro.
If you register child class it should be ok...
Regards,
Damien.
Bogdan <bogdan.indy_at_[hidden]> a écrit :
> Hi all,
>
> I am unable to use the following functionality in boost 1.42 built with
> Visual Studio 2008:
>
> - serialize/deserialize a derived class via a base class pointer using
> polymorphic archives.
> - the class serialization is implemented in a DLL using a base polymorphic
> archive.
> - the actual serialization is performed in a separate executable (linked
> with the DLL above); in that executable I use a polymorphic text archive.
>
> The documentation states this scenario is legitimate; however none of the
> tests shipped with boost demonstrates it (there are examples either about
> polymorphic classes or polymorphic archives but no test combining both).
>
> The example proving my point is a variation of the test using
> test_dll_exported.cpp and polymorphic_derived2.cpp where I removed the
> template-based archives defeating the purpose of polymorphic archives.
> My example throws an exception before main(), complaining the serializers
> try to register twice with the archive map singleton of the polymorphic base
> class.
>
> I described the same issue in the thread "[serialization] Can one
> deserialize a derived classes via pointers to the base class using
> polymorphic archives in a DLL context?" I posted in
> gmane.comp.lib.boost.devel where I provided more implementation details.
> Robert Ramey has graciously replied with a series of suggestions;
> unfortunately my example seems to have fulfilled all the conditions he
> mentioned.
>
> So, my question is: has anyone been able to run successfully a scenario
> similar to the one I described?
>
> Thank you,
>
> Bogdan
>
> ============================================================================
> ======
>
> I am enclosing a bare-bone example containing 8 files in two project files
> plus one solution file.
>
> My environment setup contains:
>
> _CL_=/D_HAS_ITERATOR_DEBUGGING#0 /D_SECURE_SCL#0 /wd4996 /wd4503
> /DBOOST_ALL_NO_LIB
> BOOST_HOME=C:\_APP_\boost_1_42_0
>
> Boost header files are installed under %BOOST_HOME%\include while the
> libraries are installed under %BOOST_HOME%\lib.
> I used Boost libraries (multi-threaded DLL versions) built with no automatic
> dependencies (note /DBOOST_ALL_NO_LIB above).
> Their names are boost_serialization-mt.lib and boost_serialization-mt-gd.lib
> for Release/Debug configurations, respectively.
>
> The PropertyPages/ConfigurationProperties/Debugging/Environment contains:
> PATH=$(BOOST_HOME)\lib;$(PATH) used while debugging.
>
>
>
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