Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with Serialization: invalid signature
From: Stefan Strasser (strasser_at_[hidden])
Date: 2013-04-04 09:39:43


Zitat von Alexander Striffeler <a.striffeler_at_[hidden]>:

> However, both variants returned an invalid signature exception even
> though I haven't changed anything on the serialized data.

I cant think of a good reason why this would happen with your code.
invalid_signature is only thrown if the archive signature isnt found
at the beginning of the archive. so you should receive this exception
before deserializing any objects.

could be because the archive was created with the no_header flag, or
missing ios::binary, or using a binary archive that was created on a
different architecture (sent data through network?), ..., but none of
that is in your code example. if you're not using old archives created
by other code: no idea.

however, since you seem to also serialize individual objects, you
might be interested in this archive: http://pastebin.com/PTdRE8tR

it serializes objects directly to a std::vector<char> or any other
char container, circumventing streams. The Serialization library is
only invoked on demand, if your objects are track_never and
object_serializable no Serialization archive is constructed.

constructing a binary_oarchive for each object can be quite expensive
(codecvt construction, pimpl construction, archive internals for
pointer tracking, ...)


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