Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] problem using BOOST_CLASS_EXPORT macro in a static library
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2009-02-11 09:13:31


Emil Dotchevski wrote:
> BOOST_CLASS_EXPORT relies on global objects' constructors to register
> the necessary types, however the C++ standard allows a compiler to
> strip away such objects unless they are actually used.
>
> The C++ standard guarantees that all global objects contained in a
> compilation unit (a CPP file) are initialized by the time execution
> enters a function from that compilation unit. So, if execution never
> enters a function from that compilation unit, the compiler is allowed
> to deadstrip it.
>
> You have 2 options:
>
> 1) tinker with your code to trick the compiler into leaving in (not
> deadstripping) the automatic BOOST_CLASS_EXPORT registration (which is
> usually possible), or
>
> 2) register the classes explicitly (not automatic, but guaranteed to work)

I can't find 2 in the docs, Can you point me to where to find it?

Thanks, Jeff


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