Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] conflicting declaration(BOOST_CLASS_EXPORT)
From: jens weller (jensweller_at_[hidden])
Date: 2008-09-24 01:11:03


Jeff Flinn wrote:
> 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

Unfortunately it does not work for me.

"Die Anweisung "0x00411b4c" verweist auf Speicher in "0x000000000". Der
Vorgang "written" konnte nicht auf den Speicher durchgeführt werden."

thats what I get as soon as I compile in Releasemode.
Debug Version runs without errors, so I guess the code is ok.

My Export.cpp:

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include "Include.hpp"
#include "FileNode.hpp"
#include "DirNode.hpp"
#include "Observer.hpp"

namespace codemodel
{
BOOST_CLASS_EXPORT( Include )
BOOST_CLASS_EXPORT( FileNode )
BOOST_CLASS_EXPORT( DirNode )
BOOST_CLASS_EXPORT( ParentNode )
//*/
}

I'm using SVN Version of boost, about a week old.
I currently have no short example, but will try to get one working.
Anything wrong with this code?
Any hints why it fails in Releasemode?

regards,

Jens Weller


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