Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] unable to fix UNREGISTERED CLASSexception
From: David Graf (david.graf_at_[hidden])
Date: 2010-02-17 13:37:27


Hello Robert

Sorry to bother you again, but I am unable to use force_include correctly. I guest the makro BOOST_USED must be used, correct? I wrote BOOST_USED into each function header in the example. But it doesn't change anything.

David

On Feb 17, 2010, at 5:25 PM, Robert Ramey wrote:

> This is likely due to the fact that a static linker will only include
> modules which have have been explicitly referred to. The library uses
> "force_include" to implement this when it can. You'll just have to figure
> out what the linker is excluding and make sure it's included.
>
>
> Robert Ramey
> 830 Cathedral Vista Lane
> Santa Barbara, CA 93110
> (805)569-3793
> www.rrsd.com
> -----Original Message-----
> From: David Graf [mailto:davidagraf_at_[hidden]] On Behalf Of David Graf
> Sent: Wednesday, February 17, 2010 8:08 AM
> To: boost-users_at_[hidden]; Robert Ramey
> Subject: Re: [Boost-users] [Serialization] unable to fix UNREGISTERED
> CLASSexception
>
> Hello Robert
>
> I fixed the example. I had to add somewhere a virtual function. Otherwise,
> the polymorphism doesn't work.
>
> Unfortunately, I have a new problem. If I put the code into a static
> library, the serialization from the outside doesn't work anymore. Then, I
> get a unregistered class exception. It only works when I put the code to
> execute the serialization into the cpp file where the classes are registered
> with BOOST_CLASS_EXPORT_GUID.
>
> Again, I attached the example source code. The library is created with
> cmake. Therefore, you need to have cmake installed on your machine to test
> the example. The commands to build the example are cd
> /path/to/unpacked/testfolder mkdir build cd build cmake ..
> make
>
> Funnily enough, the serialization from the outside (from the main function)
> works if the serialization in the cpp file is executed in advance.
>
> The example works if the library is a dynamic library. If you wanna see
> this, you need to replace STATIC in CMakeLists.txt with SHARED.
>
> David
>
>
>


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