I have a .NET application which serializes an object in binary format. this object is a struct consisting of a few fields.
I must deserialize and use this object in a C++ application. I have no idea if there are any serialization libraries for C++, a google search hasn't turned up much.
What is the quickest way to accomplish this?
Thanks in advance. Roey.
Update : I have serialized using Protobuf-net , in my .NET application, with relative ease. I also get the .proto file that protobuf-net generated, using GetProto() command. In the .proto file, my GUID fields get a type of "bcl.guid", but C++ protoc.exe compiler does not know how to interpret them! What do I do with this?
Can you edit the .NET app? If so why not use XML Serialization to output the data in a easy to import format?
If you are using BinaryFormatter
, then it will be virtually impossible. Don't go there...
Protocol buffers is designed to be portable, cross platform and version-tolerant (so it won't explode when you add new fields etc). Google provide the C++ version, and there are several C# versions freely available (including my own) - see here for the full list.
Small, fast, easy.
Note that the v1 of protobuf-net won't handle structs directly (you'll need a DTO class), but v2 (very soon) does have tested struct support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With