Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-05-29 18:35:38


Cyril Picat wrote:
> Ok, I thought that BOOST_CLASS_EXPORT will take care of instantiating
> it.

It is not know when the library is built for which archive classes it should
be
instantiated - unless you include the archive headers and use
explicit instantiation.

Actually isn't it what is explained in the doc in paragraph
> 'Exporting Class Serialization'? I am a bit confused and sure I
> should dive into the Boost.Serialization code to understand more what
> the macro is doing.

I'm not sure which version you're using. The version in the trunk
has updated information on BOOST_CLASS_EXPORT which
tries to be more clear about this confusing topic.

> The problem with your solution is that I don't want to include any
> Boost header in Example.hpp.

Hmm - if you want to specify a member function serialize - Its
not unreasonable to have to include the boost head which
declares its arguments.

>So I have tried the solution from
> demo_pimpl but it still fail to link with vc 8.0 (there is a comment
> saying that it fails with vc 7.0)? Is it expected?

I think it passes with vc 7.1 - as far as I know the example is correct.

A deeper investigation of this might resolve the confusion.

>
> So I have ended with forward declaring the archives I need in
> Example.hpp and it works.

> Though, I would rather but the explicit template instantiation in
> Example.cpp to keep a clean implementation agnostic header. Is there
> any way to make this work with VC ?

Here's what I thnk you want to do:

a) make your serialize functions - include boost serialization headers
b) make a module in your library which includes the archive headers
or ALL the archives you might want to use.
c) explicitly instantiate all your serializaiton functions for these
archives

Then you main program should link with no problem. It will compile
faster and include only that code actually used.

The same solution works for serialization code in DLLS.

Robert Ramey


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