Convert C ++ header file to protobuf.proto file

I am wondering if there is any tool that I can use to convert a .h file to a .proto file for c ++? I want to do the following: I have several structures in the .h file, and I want to serialize them and send via protbuf. To do this, I need a .proto file to generate the .pb.h and .pb.cc files, and then I can serialize the structures and send them.

Does anyone know if there is such a tool? I could do it manually, but it will take me a lot of time because the header file contains many structures.

Thanks!

I am editing my question to inform you that I did not find what I asked for, but I found this https://code.google.com/p/protobuf-csharp-port/wiki/ProtoGen tool, which was also very useful. As a parameter, you specify the .proto file, and it generates C # code. Hope it helps!

+9
source share
2 answers

I don’t know the protocol at all, but I found this . Try to read this

0
source

No, this is not possible, it would be like writing a reverse compiler from machine language back to human-readable C ++.

-1
source

Source: https://habr.com/ru/post/977765/


All Articles