Commit graph

2 commits

Author SHA1 Message Date
Hong Shin
4f20efbb78 Internal Change
PiperOrigin-RevId: 546867607
2023-07-10 07:37:00 -07:00
Marcel Hlopko
5814f6c977 Generate C++ thunks for Rust protos
In this CL I'd like to call existing C++ Protobuf API from the V0 Rust API. Since parts of the C++ API are defined inline and using (obviously) C++ name mangling, we need to create a "thunks.cc" file that:

1) Generates code for C++ API function we use from Rust
2) Exposes these functions without any name mangling (meaning using `extern "C"`)

In this CL we add Bazel logic to generate "thunks" file, compile it, and propagate its object to linking. We also add logic to protoc to generate this "thunks" file.

The protoc logic is rather rudimentary still. I hope to focus on protoc code quality in my followup work on V0 Rust API using C++ kernel.

PiperOrigin-RevId: 523479839
2023-04-11 12:58:34 -07:00