Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] link error and exception onget_key
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-01-16 00:21:31


does the header file of polymorphic_derived1's include the following?

BOOST_CLASS_TYPE_INFO(

polymorphic_derived1,

extended_type_info_no_rtti<polymorphic_derived1>

)

Also, the *.cpp file of polymorphic_derived1 should contain

BOOST_CLASS_EXPORT(polymorphic_derived1)

Robert Ramey

  "Daniel Roberts" <impulsionaudio_at_[hidden]> wrote in message news:14125aaf0901151528p8f354ffp9409248decf7958c_at_mail.gmail.com...
  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 mailing list
  Boost-users_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



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