1
votes

I want to serialize an object in using boost in C++ then deserialize it from a C# program. So, I want to write the deserialize part by my self ( I will not deal with complex structs). Is this possible ? and where can I find the serialization protocol that Boost uses?

1
Boost is available in sources. There you see the protocol easily :) - SergeyA
it is much harder to read them from a source code. it would be much easier if there is a documentation for that. However, if I do not find any, it would be the only solution. thanks - Humam Helfawi
It is not an answer for your question, but you should consider using Google's Protocol Buffers instead. I haven't looked at Boost Serialize for quite a long time, but it was just a really wrong library to use for such purposes several years ago. - Roman Dobrovenskii

1 Answers

1
votes

As the commenter said, Protocol Buffers were specified as an interoperable format by design. I would recommend using that (or one of the existing serialization libraries with similar features).

Other than that, you can look at implementing your own archive format, so you have close control of what gets serialized how.

Note that if your object graph is significantly complex, you will want to come up with some kind of Object Tracking implementation that works on both ends. This could be an area where the custom Archive implementation has no effect¹


Out Of The Box, Thinking

If you are using Microsoft Visual C++ compiler (because you also use C#...) you should consider using Boost Serialization to read the C++ object graph and transforming to CLR types in a mixed-mode assembly:

¹ haven't checked.