简体   繁体   中英

can i use protobuf-c both in C++ and C?

i'm new one to protobuf-c i have altered protobuf-c client and server example program as per my requirement and i got this program through this link

code.google.com/p/protobuf-c/wiki/RPC_Example

now i have to write server side programing in c++ and i want to use the client side program in c itself this my new requirement

can any one please help me how to use the .h and .c proto file that is compiled using protobuf-c in c++ server side program file
any suggestions will be appreciated

As pointed by @Konrad Rudolph, the entire point of protobuf is to use same message format with different languages. So, you do the following:

  1. Write your .proto file
  2. Compile this .proto file with protobuf-c for client code and with protobuf (protoc) for server code (that would be different classes, but same message format!)
  3. Link client code to protobuf-c and server code to protobuf

This will resolve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM