Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-04-19 23:09:24


There is a test program which demostates that this facility fuctions:

It's named "test_no_rtti" or something like that.

I make the "no rtti" version as sort of an after thought. My idea
was the the type identification method be an attribute of the
class as other serialization attributes were. Thus one could
declare everything regarding how an type is to be serialized
in the *.h file and include it in all your programs and archives
containing instances of the given type would be transportable.

So I was concerned that a program support varying methods.
That is, I envisioned the usage of "on rtti" as a class attribute
rather than a program attribute.

So i wrote test_no_rtti to demonstrate and test this facility.
As an example, I made a special version of extended_type_info
(extended_type_info_nortti) as a test. It uses the exported
class name as an identifier so it requires that the class be
exported by name.

So my test did/does demostrate that the serialization library
can be used without rtti. However.

test_no_rtti - fails without RTTI enabled. This is because the
test is mis-named. It should be called test_no_rtti_rtti_interoperability.

In order to not use the extened_type_info_no_rtti example
as a basis for your program, you would have to make sure
that all your types (an all imported types) use it. The library
address this by including the default "extended_type_info.hpp"
if not other extended_type_info system has been specfied. This
facility has been the source of some infamous header ordering
issues which have since been addressed.

So it has been addressed. It hasn't been documented well
nor has it been tested exhaustively. If one had nothing else to
do he could tweak the serialization test so it would run ALL
the tests with no_rtti. But no one has need it badly enough
to to this work.

I don't knowwhat else to tell you.

Robert Ramey

> Hi,
>
> I very much want to use boost serialization but can't enable RTTI in
> my compiler (vc7/vc8) because of compatibility restrictions with other
> code.
>
> I've seen various statements on the web that boost serialization will
> work without RTTI, but no concrete instructions about how to make this
> happen.
>
> I've tried writing a trivial app using
> boost::archive::binary_oarchive, but I get this compiler warning
> (which is as good as an error):
>
> boost\smart_cast.hpp(76) : warning C4541: 'dynamic_cast' used on
> polymorphic type 'boost::archive::detail::basic_oarchive' with /GR-;
> unpredictable behavior may result
>
> So is it the case that, while serialization doesn't require RTTI, the
> provided archive classes do? Am I going to have to write my own
> archive class?
>
> Any help appreciated.
>
>
> cheers,
> os.


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