Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] binary archiver with generic primitive types
From: Matthias Troyer (troyer_at_[hidden])
Date: 2009-08-31 14:00:59


On Aug 31, 2009, at 7:48 PM, Florent Teichteil wrote:

> Robert Ramey a écrit :
>> Florent Teichteil wrote:
>>> This compiles fine except that I get some linker errors concerning
>>> the
>>> basic_binary_oarchive and the basic_binary_oprimitive classes. For
>>> instance:
>>> undefined reference to
>>> `
>>> boost
>>> ::archive
>>> ::basic_binary_oprimitive<boost::archive::tbinary_oarchive<unsigned
>>> char>, unsigned char, std::char_traits<unsigned char>
>>>>> :~basic_binary_oprimitive()'
>>> It seems that parts of the serialization library's code is outside
>>> the
>>> definition classes, preventing to extend it with different binary
>>> types... Is there a workaround?
>> certain code should be explicitly instantitiated. Look at
>> binary_?archive.cpp in libs/serialization/src directory
>> to see how this is done.
>
> Thank you for your help.
> I tried to copy/paste these files into my project and to modify them
> in order to compile with different primitive types. But new linker
> errors arise because more source files are required. Besides,
> copying Boost files in local project source files is dangerous
> because the copied files have to be updated along with new Boost
> versions...
>
> So I give up, but I would strongly recommend to allow native
> template archivers with generic primitive types in the Boost
> serialization library.

There is no need to copy these files. You just need to instantiate the
templates. Please look at libs/serialization/src
/binary_[io]archive.cpp

Matthias


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