Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pbc

> 编程语言
Open source

A protocol buffers library for C

1.6K stars0 likes1 views
WebsiteGitHub

About

A protocol buffers library for C

PBC

PBC is a google protocol buffers library for C without code generation.

Quick Example

package tutorial;

message Person {
  required string name = 1;
  required int32 id = 2;        // Unique ID number for this person.
  optional string email = 3;

  enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
  }

  message PhoneNumber {
    required string number = 1;
    optional PhoneType type = 2 [default = HOME];
  }

  repeated PhoneNumber phone = 4;
}
…

Message API

You can use wmessage for encoding , and rmessage for decoding.

See test/addressbook.c for details.

Pattern API

If you need better performance , you can use pbc_pattern_xxx api .

See test/pattern.c for details.

Pattern api is faster and less memory used because it can access data in native C struct.

Extension

PBC support extension in a very simple way . PBC add a specific prefix to every extension field name.

Service

Not supported

Enum

With message API , you can use both string and integer as enum type . They must be integer in Pattern API.

Lua bindings

cd binding/lua && make or cd binding/lua53 && make

See https://github.com/cloudwu/pbc/tree/master/binding/lua/README.md

Building pbc - Using vcpkg

You can download and install pbc using the vcpkg dependency manager:

bash
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install pbc

The pbc port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Question ?

  • Send me email : http://www.codingnow.com/2000/gmail.gif
  • My Blog : http://blog.codingnow.com
  • Design : http://blog.codingnow.com/2011/12/protocol_buffers_for_c.html (in Chinese)
  • Build for Visual Studio 2012 : https://github.com/miaodadao/pbc

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言