Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Polymorphic serialization withpolymorphic archives problem...
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-02-23 00:41:51


Bogdan wrote:

> 3. serialization files in a separate dll. Both the main executable
> and my dll link with the dll version of the serialization library:
>
> main.exe
> my_serialization.dll
> boost_serialization.dll
>
> my_serialization.dll
> boost_serialization.dll
>
> Builds OK but FAILS at runtime , at run time I get a C++ exception
> BEFORE main() in basic_serializer_map.cpp around the line 48:
>
> 'archive_exception::multiple_code_instantiation with the message "code
> instantiated in more than one module - polymorphic_base"'

This would indicate that the serialization for polymorphic_base is included
in BOTH the mainline and the DLL. Check that the serialization function
is NOT an inline definition. the polymorphic_base.cpp should only be needed
when compiling the DLL.

option 1

include serialization definition for polymorphic_base in
my_serialization.dll

option 2

include serialization definition for polymorphic_base in it's own dll.

> 4. serialization files in a separate dll. Both the main executable
> and my dll link with the static version of the serialization library:
>
> main.exe
> my_serialization.dll
> boost_serialization.lib
>
> my_serialization.dll
> boost_serialization.lib
>
> Builds OK but FAILS at runtime while trying to serialize with the
> following exception thrown in oserializer.hpp(line 424):struct
> polymorphic::save():
>
> 'unregistered void cast class polymorphic_derived1<-polymorphic_base
> in function 'int __cdecl main(int,char *[])''

This is probably failing due to the compiler stripping out code
not explicitly referred to. Since it's not referrred to, the linking
doesn't include it from the library.

Robert Ramey


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