Protobuf-net interacting with C ++

I look at protobuf-net for implementing various messaging formats, and I especially like the contractual approach, since I don't have to bother with the proto-compiler. One thing I couldn’t find information on, that it makes cross-platform work difficult? there are several C ++ applications that would have to parse PB data, and although I understand that protobuf-net is serialized in the standard PB format if I use a contractual approach and not a proto file, like C ++ parsing data?

can (should?) I write a separate proto file for (very few) cases where C ++ needs to understand the data? and if so, how exactly do I know that the C ++ class generated from the proto file will match the data from non-proto C # files?

+3
source share
1 answer

Yes, theoretically, at least they should match at the binary level, but you can limit yourself to types that just map to ".proto" - so avoid things like DateTimeinheritance ( [ProtoInclude]), etc. This also has the advantage that you should be able to use:

string proto = Serializer.GetProto<YourType>();

.proto; (GetProto) 100%, . - " "; , , .. .

+1

Source: https://habr.com/ru/post/1726723/


All Articles