Boost logo

Boost :

Subject: Re: [boost] [1.44][serialization] Link error with polymorphicarchiveand BOOST_CLASS_EXPORT
From: Wilson Tim-CTW024 (Tim.Wilson_at_[hidden])
Date: 2011-01-21 18:16:18


Thanks for the reply.

I'm afraid you misunderstood my post. I *know* that BOOST_CLASS_EXPORT
is only required for derived classes; and in my actual application,
that's certainly what I'm attempting to use it for.

The code I posted was just the very simplest code that illustrates the
problem, which is (as I said): if I try to use *both* BOOST_CLASS_EXPORT
and either of the polymorphic archives, I get a link error.

Please try compiling my simple example, *with* the BOOST_CLASS_EXPORT()
in there, and see what you get.

P.S. Thanks for the suggestion on opening the ostringstream "binary".
 

-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of Robert Ramey
Sent: Friday, January 21, 2011 5:08 PM
To: boost_at_[hidden]
Subject: Re: [boost] [1.44][serialization] Link error with
polymorphicarchiveand BOOST_CLASS_EXPORT

Wilson Tim-CTW024 wrote:
> I've run into a conflict between use of the polymorphic archives and
> the BOOST_CLASS_EXPORT() macro. It doesn't seem possible to use both
> without getting a link error. The following code illustrates the
> problem (yes, I know this code doesn't do anything worth doing, but
> it's the simplest code that demonstrates the problem):
>
> ----------------------
>
> # include <sstream>
>
> # include <boost/serialization/export.hpp> # include
> <boost/archive/polymorphic_binary_oarchive.hpp>
>
> class A {
> public:
>
> template<class Archive>
> void serialize(Archive & ar, const unsigned version) { }
>
> };
>
> ///BOOST_CLASS_EXPORT(A); // need only for derived classes
>
>
>
> int main() {
>
> A a;
>
> std::ostringstream os(std::ios_binary); // make sure stream is opened

>binary // boost::archive::polymorphic_binary_oarchive oa(os);
>boost::archive::polymorphic_oarchive & oa =
>boost::archive::polymorphic_binary_oarchive(os);
> oa & a;
> }
>

Try the above changes.

Robert Ramey

_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk