Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] link error and exception onget_key
From: Daniel Roberts (impulsionaudio_at_[hidden])
Date: 2009-01-16 14:09:56


I got the test to work but in my own code I am getting an "unregistered void
cast" exception when trying to serialize the derived type. I moved the
relevant classes into a separate test and made sure everything was identical
to the test I made that does work (e.g. macro placement, include order) and
I still get the exception. If I move the derived class definition into the
header file it works. The function definitions don't even have to be
inlined, they just need to be in the header. This is very weird. I am not
sure you can help but if you have any ideas I would appreciate it.
Thanks,
Daniel Roberts

I just separated things out and things seemed to work fine. The only thing
that might
or might not be an issue is header order:

#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/export.hpp>
#include "polymorphic_derived1.hpp"
BOOST_CLASS_EXPORT(polymorphic_derived1)
const char * polymorphic_derived1::get_key() const {
return
boost::serialization::type_info_implementation<
polymorphic_derived1
>::type::get_const_instance().get_key();
}

Notice I specified extended_type_info_no_rtti.hpp before export.hpp. If I
remember
correctly, if no type id system header is specified before export is
encountered
the system may take the rtti one as the default. Since we're not using
defaults
in this example, its probably not an issue.

As far as I know, no one has ever asked a question about using EXPORT
without
rtti before - at least no one has ever had any questions about it. You may
be
treading new ground here.

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