A C implementation of Google Protocol Buffers for serializing structured data with code generation and runtime library.
protobuf-c is a C implementation of Google Protocol Buffers, providing both a code generator that converts `.proto` files to C code and a runtime library for serializing and deserializing structured data. It solves the problem of efficient, language-neutral data exchange in C applications, particularly where performance and resource constraints matter. The project enables developers to use Protocol Buffers' compact binary format and schema evolution capabilities in pure C environments.
C developers working on embedded systems, network protocols, performance-critical applications, or any project requiring structured data serialization without C++ dependencies. It's also valuable for teams implementing cross-language communication where C is part of the stack.
Developers choose protobuf-c because it provides a complete, production-ready Protocol Buffers implementation specifically for C, with proper versioning and build system integration. Unlike using the C++ implementation in C projects, it offers a pure C solution with smaller footprint and better compatibility with constrained environments.
Protocol Buffers implementation in C
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a C-only runtime library (libprotobuf-c) without C++ dependencies, making it ideal for embedded systems and constrained environments as highlighted in the README.
Integrates with Google's protoc compiler via the protoc-gen-c plugin to automatically generate C descriptor code from .proto files, ensuring compatibility with the Protocol Buffers ecosystem.
Generated headers include version checks to prevent ABI conflicts, as noted in the README's versioning section, reducing compatibility issues between generated code and runtime library.
Offers pkg-config support and autotools macros (e.g., PKG_CHECK_MODULES) for easy compilation and linking, simplifying integration into existing C project workflows.
Requires Google's protobuf C++ library, a C++ compiler, and autotools for from-source builds, adding setup overhead and potential portability issues, as specified in the README.
RPC implementation is split into a separate project (protobuf-c-rpc), so it lacks built-in support for gRPC or similar protocols, limiting its out-of-the-box functionality.
The README warns against using generated code in stable library APIs due to version skew, as it embeds the protobuf-c ABI, making it unsuitable for long-term ABI-stable projects.