To pack a message, first compute the packed size of the message with \hyperlink{group__api_gafae6d8624073687eae8a9c597a1fcbcc}{protobuf\+\_\+c\+\_\+message\+\_\+get\+\_\+packed\+\_\+size()}, then allocate a buffer of at least that size, then call \hyperlink{group__api_ga087e379c203051e66732010c1828965e}{protobuf\+\_\+c\+\_\+message\+\_\+pack()}.

Alternatively, a message can be serialized without calculating the final size first. Use the \hyperlink{group__api_gaa1cde08f1ad1408209ed427f9e0647bc}{protobuf\+\_\+c\+\_\+message\+\_\+pack\+\_\+to\+\_\+buffer()} function and provide a \hyperlink{struct_protobuf_c_buffer}{Protobuf\+C\+Buffer} object which implements an \char`\"{}append\char`\"{} method that consumes data.

To unpack a message, call the \hyperlink{group__api_ga1e88dc4ae2aa7d5bdb593662ba212f22}{protobuf\+\_\+c\+\_\+message\+\_\+unpack()} function. The result can be cast to an object of the type that matches the descriptor for the message.

The result of unpacking a message should be freed with \hyperlink{group__api_ga67d71b3349faa97e879e888e88c8029e}{protobuf\+\_\+c\+\_\+message\+\_\+free\+\_\+unpacked()}. 