|
Boost : |
From: Rene Rivera (grafik.list_at_[hidden])
Date: 2004-10-29 15:05:09
I took some time to take a closer look at what the current test failures
could be about on the cw-8.3 compiler... before I go on vacation.
Specifically I looked at the test_exported errors as those seemed to be
common to both the 9 and 8 versions of CW. My findings...
I managed to get the export tests to *pass* by modifying the test itself
(see attached). The problems boils down to the behavior of CW to only
instantiate templates when they are used. This not just applies to class
templates, but to template methods. In the case of the exported tests it
does not instantiate two important things:
a) The serialize template method of non-directly referenced derived
classes. Specifically for test_exported:
polymorphic_derived1::serialize<test_oarchive>,
polymorphic_derived1::serialize<test_iarchive>,
polymorphic_derived2::serialize<test_oarchive>,
and polymorphic_derived2::serialize<test_iarchive>.
Forcing those to be instantiated generates all the rest of the self
registration code for the derived classes. This still leaves:
b) The archive serialization instance for the needed specializations is
also not generated as they are not directly reference. Only the ones for
the base class, polymorphic_base, are generated as that's the class used
in the actual de/serialize calls.
I'm not sure anything can be done about fixing this for the release as
the only solutions I can come up with would involve changing the
serialization interfaces.
HTH.
-- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
===================================================================
RCS file: /cvsroot/boost/boost/libs/serialization/test/test_exported.cpp,v
retrieving revision 1.4
diff -u -r1.4 test_exported.cpp
--- test_exported.cpp 22 Jul 2004 06:39:17 -0000 1.4
+++ test_exported.cpp 29 Oct 2004 19:36:07 -0000
@@ -40,6 +40,7 @@
class polymorphic_derived1 : public polymorphic_base
{
friend class boost::serialization::access;
+public:
template<class Archive>
void serialize(Archive &ar, const unsigned int /* file_version */){
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
@@ -49,10 +50,19 @@
};
BOOST_CLASS_EXPORT(polymorphic_derived1)
+namespace {
+ void (polymorphic_derived1::* pd1so_p)(test_oarchive &,const unsigned int) = &polymorphic_derived1::serialize<test_oarchive>;
+ void (polymorphic_derived1::* pd1si_p)(test_iarchive &,const unsigned int) = &polymorphic_derived1::serialize<test_iarchive>;
+}
+template<>
+const boost::archive::detail::pointer_iserializer<polymorphic_derived1, test_iarchive> boost::archive::detail::pointer_iserializer<polymorphic_derived1, test_iarchive>::instance;
+template<>
+const boost::archive::detail::pointer_oserializer<polymorphic_derived1, test_oarchive> boost::archive::detail::pointer_oserializer<polymorphic_derived1, test_oarchive>::instance;
class polymorphic_derived2 : public polymorphic_base
{
friend class boost::serialization::access;
+public:
template<class Archive>
void serialize(Archive &ar, const unsigned int /* file_version */){
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
@@ -62,6 +72,14 @@
};
BOOST_CLASS_EXPORT(polymorphic_derived2)
+namespace {
+ void (polymorphic_derived2::* pd2so_p)(test_oarchive &,const unsigned int) = &polymorphic_derived2::serialize<test_oarchive>;
+ void (polymorphic_derived2::* pd2si_p)(test_iarchive &,const unsigned int) = &polymorphic_derived2::serialize<test_iarchive>;
+}
+template<>
+const boost::archive::detail::pointer_iserializer<polymorphic_derived2, test_iarchive> boost::archive::detail::pointer_iserializer<polymorphic_derived2, test_iarchive>::instance;
+template<>
+const boost::archive::detail::pointer_oserializer<polymorphic_derived2, test_oarchive> boost::archive::detail::pointer_oserializer<polymorphic_derived2, test_oarchive>::instance;
// save exported polymorphic class
void save_exported(const char *testfile)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk