|
Boost Users : |
Subject: Re: [Boost-users] [serialization] link error and exception on get_key
From: Daniel Roberts (impulsionaudio_at_[hidden])
Date: 2009-01-15 18:28:58
Thanks for the response. Yes, I am using the no rtti option. I downloaded
test_no_rtti.cpp and got it to work as-is. I then made the following
changes:
1) Move polymorphic_base's definition into its own header file.
2) Move polymorphic_derived1's definition into its own header file.
3) Move the definition of polymorphic_derived1::get_key() into an
implementation file.
Making these changes causes the assertion failure. I am using boost v1.36.0
and Visual Studio 2008 9.0.30729.1 SP
Thanks,
Daniel Roberts
I presume you're using the "no rtti" option? get_key used only for those
systems which
use which depend on extended_type_info_no_rtti to handle extended_type_info
functionality.
with which compiler?, which version of boost?
"Daniel Roberts" <impulsionaudio_at_[hidden]> wrote in message news:
14125aaf0901142057s6ba59d08tc98a6990a5f78bca_at_mail.gmail.com...
I have a derived class that exports its type and overrides get_key for
serialization through a base class pointer. If I move the definition of the
overridden get_key function out of the header into a cpp file, an assertion
fails on line 49 of extended_type_info.cpp.
Take a look at the example "test_no_rtti". the class polymorphic_derived
has a get_key
declaration - but the get_key definition is not inline. This would seem
identical your case.
You might want to make a small variation of test_no_rtti such that the
definition of
polymorphic_derived1::get_key defintion is moved to a separate source and
verify that
it builds and runs correctly.
If I define any other functions in the cpp file, I get a linker error
saying that the get_key symbol is already defined. It looks to me that any
serializable derived class must be completely defined in the header file. Is
this correct?
If so, why does such a limitation exist?
I don't think this limitation exists
Thank you
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