Once written, a protobuf specification can be compiled using protoc to a variety of implementations in different languages (e.g. python, c++, go). That's great. But to compile that generated code, you need a protobuf development library and, if I am not mistaken, a runtime is required as well.

Is there a way to generate the implementation code in a pure-language, self-contained fashion? So, for example, I would compile my implementation to C++ and Python, distribute it and people could use it by just using the standard library.

If not, are there frameworks (similar to protobuf in principle) that, given a specification, produce a serialization code which is stand alone and does not require other non-standard libraries for a given language?

This question stems from the fact that recently I had to use protobuf on different systems and each one had a different development library available. Should the specification be compiled on each system separately? What if the compilers have different versions?

1 Answer 1


An "all platforms" target would, by necessity, have to offer a least-common-denominator API, which means it would be unfriendly to use from most languages, and not idiomatic. So no: the usual approach is to prefer platform/language-specific tools which can each make use of the most appropriate APIs and techniques for that platform/language in the API.

The compiler version being different shouldn't matter - the underlying serialization format hasn't changed at all in the time that protobuf has been publicly abailable. It'll still work - as long as the language parser supports the syntax version you're using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.