No, the in-memory representation of a C# message is in no way related to 
the serialized representation.
If your C++ code is just sending the serialized protobuf though, I don't 
think you'd need to deserialize in the C++ code - just serialize in C#, 
pass the byte array to the C++ code, and get that to send it directly.

(This is what gRPC does, for example.)

On Sunday, 28 May 2017 22:23:15 UTC+1, Mike Bennett wrote:
>
> Hi -- I have a C++ library which sends protobuf messages over the network 
> and I'd like to
> provide a C# wrapper that allows the client application the ability to 
> generate a protobuf,
> pass it to native code and have the native code consume it directly.
>
> Is the C# 'at rest' representation of a protobuf message compatible with a 
> C++ layout
> of the same message? That is, if I've created C# code that built a 
> protobuf message,
> can I directly pass it somehow to C++ as a protobuf (if I could get the 
> raw byte pointer
> to the message), or do I have to first serialize it to a buffer, pass the 
> serialized buffer
> to C++ then deserialize it in C++?
>
> I'd really like to avoid the deserialization/serialization on either side 
> of the C#/C++
> boundary for performance.
>
> Thanks for any information or pointers!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to