Hello everyone,
I'm new to boost in general, as well as to the serialization
library, so I expect that I'm probably overlooking a few things.
I have searched the archives, and I've seen threads that are
clearly related to what I'm doing, but their approaches were a bit different
than mine (ie. some had the option of including concrete classes directly).
General Info:
I'm using boost 1.35.0.
My target platform is Windows XP.
I'm building with MSVC8 SP1.
What I Need:
I'm building an interface-driven library (all the exposed
classes are pure abstract interfaces).
This library resides in its own DLL, but we can assume that
it is always loaded when we're serializing data.
The concrete classes in this library (not exposed) implement
boost serialization support.
External applications should be able to link against boost,
create archives, and use them to serialize my library's objects through my
library's interface pointers.
What I Tried:
I've attached an MSVC8 solution with a sample executable and
dll.
The library exposes an interface, hides a concrete
implementation of the interface, and exposes a factory function for retrieving
an instance.
The application retrieves an instance of the class,
instantiates a polymorphic binary archiver, and serializes the object through
the interface pointer using the archiver.
What Goes Wrong:
In the release configuration, the test program appears to
work.
In the debug configuration, the app fails an assert
(extended_type_info.cpp:74 lookup(eti) == m_self->m_map.end()). This seems
to be the multiple-registration issue which has been discussed in earlier
threads.
Why doesn't the assertion fail in release?
My Workaround:
I've seen it mentioned in earlier threads that I should move
the actual serialization calls into the DLL.
To that end, I created a MyLibrarySerializer class which
simply forwards the serialization call.
This seems to work, but since I just started using this
library, I can't tell if I've overlooked a better solution or if I'm
introducing some obscure bugs using this method.
Questions:
Will my solution work the way I expect it to (Am I
overlooking any major pitfalls)?
Am I overlooking a better solution (Is there a way to
accomplish this without introducing the MyLibrarySerializer class)?
Why does my original solution appear to work in the release
configuration?
Threads I'm using for reference:
http://thread.gmane.org/gmane.comp.lib.boost.user/8281
http://thread.gmane.org/gmane.comp.lib.boost.user/13440
http://thread.gmane.org/gmane.comp.lib.boost.user/28735
http://thread.gmane.org/gmane.comp.lib.boost.user/30837
Thanks for your time and patience,
Andrew Gray