开发者

Is there a good C implementation of Google Protocol Buffers

开发者 https://www.devze.com 2023-01-15 14:25 出处:网络
Google officially provides a C++ implementation of Google Protocol buffers, but I\'m looking for a C implementation.

Google officially provides a C++ implementation of Google Protocol buffers, but I'm looking for a C implementation.

I will not be using it myself, but my hope is that I can use this tool to generate C code for our Google Prot开发者_如何学Pythonocol Buffer definitions which I can then hand of to the C developers.

I'm not looking for any RPC functionality, simply encoding and decoding of Google Protocol Buffer messages.


Use protobuf-c (now at Github as protobuf-c).

From their official site:

This package provides a code generator and runtime libraries to use Protocol Buffers from pure C (not C++).

It uses a modified version of protoc called protoc-c.


There's also Nanopb which is more light-weight.

For example, it does not store message and field names in the code, so introspection (searching a field by name) is not possible.


pbtools is another alternative. It generates fast C source code to encode and decode protobuf messages.

Also, there is a list of more C implementations here: https://github.com/protocolbuffers/protobuf/blob/master/docs/third_party.md


μpb is a small protobuf implementation written in C.

upb generates a C API for creating, parsing, and serializing messages as declared in .proto files. upb is heavily arena-based

0

精彩评论

暂无评论...
验证码 换一张
取 消