Boost序列化在32位和64位计算机之间不起作用。还有其他序列化/压缩库吗? [英] Boost serialization does not work between 32bit and 64bit machine. Any other serialization / compression library?

查看:123
本文介绍了Boost序列化在32位和64位计算机之间不起作用。还有其他序列化/压缩库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用boost库在64位计算机上进行序列化并在32位计算机上进行反序列化。但是,它似乎不起作用。 (我使用1.57.0)。

I am trying to use the boost library to serialize on 64bit machine and de-serialize on 32bit machine. However, it seems it does not work. (I use 1.57.0).

如果我运行以下代码

boost::asio::streambuf buf;
std::ostream os(&buf);
boost::archive::binary_oarchive oa(os);
printf("Buffer size %d\n",(int)buf.size());

32位计算机的输出为 37 ,而64位计算机的输出为 41

The output of 32bit machine is 37 and the output of 64bit machine is 41.

我还能使用其他好的序列化库吗?
谷物如何?

Is there any other good serialize library I can Use? How about cereal?

如果库也可以进行压缩(zlib / gzip等),那就太好了。

It's great if the library can do compression as well (zlib/gzip etc.).

推荐答案

它确实有效。它只是不会创建兼容的存档。如果需要,您应该查看EOS所做的归档实现:

It does work. It just doesn't create compatible archives. If you want that you should look at the archive implementation that EOS made:

  • EOS Portable Archive

您可以直接替换Boost的binary_ [io]存档。

You can drop-in replace Boost's binary_[io]archive with it. No need to change anything else.

PS。

这篇关于Boost序列化在32位和64位计算机之间不起作用。还有其他序列化/压缩库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆