Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] conflicting declaration(BOOST_CLASS_EXPORT)
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-09-19 08:09:02


jens weller wrote:
> Robert Ramey wrote:
>> try the following re export:
>>
>> a) re-read the manual regarding boost class export
> I did, any points you think about?
>> b) Try using BOOST_CLASS_EXPORT only once.
>
> So far I thought after each class I could just set a
> BOOST_CLASS_EXPORT($classname),
> as far as its derived from a serializable class.
> So, how to use it "only once"?
> Should I put those all in one file instead? ("exportmodel.hpp" f.e.)

Hi Jens,

I think Robert means that BOOST_CLASS_EXPORT($classname) may only be
expanded once in your program for a particular class name. And per the
docs this expansion must occur within the context of all archive types
that will be used to serialize the class.

So rather than placing these macro calls in headers(which may be
included in multiple translation units), place them in a cpp file that
first includes the desired archive headers. Typically this would be in
the class' implementation file. In the past I had placed them all in a
single file, but quickly found the MSVC7.1 compiler limits, and had to
break them up into export1.cpp, export2.cpp, ...

Jeff Flinn


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