3

I want to serialize some data-structures between a 32bit process and a 64bit process on the same windows machine with boost::serialization.

This answer suggests using eos::portable_iarchive, but when I tried that, I got a STATIC_ASSERT failure:

// implementation only valid for narrow string
BOOST_STATIC_ASSERT(sizeof(C) == sizeof(char));

Is there a different way to do this (other than text_iarchive what I don't want to use for perf considerations) that supports std::wstrings as well?

Community
  • 1
  • 1
Omer Raviv
  • 11,409
  • 5
  • 43
  • 82

1 Answers1

1

From what I've read, the standard approach to serializing wide-character strings is to first encode them as UTF-8 narrow-character strings. This may be more overhead than you want, though.

There's an alternative implementation of a portable binary archive in the Boost.Serialization example directory. The Boost.Serialization documentation makes it sound like its biggest shortcomings are lack of portable floating point support and lack of rigorous testing, so if you don't need portable floats, it may meet your needs.

I don't know if you've looked at other serialization libraries or not, but there are several alternatives, including libs11n and Protocol Buffers. (Personally, having used both Boost.Serialization and Protocol Buffers, I prefer Protocol Buffers.)

Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
  • Strange I missed that portable_binary_archive in boost example folder. It seems to work fine when used in mixed 32/64 bit environment under windows. Thank you! – Omer Raviv Oct 29 '11 at 18:07