This looks correct, but I'll mention that upb's C code generation is not a supported API surface today like our other language's generators are; it exists only as an implementation detail for other languages, as well as some other legacy needs.
Use at your own risk, and there may be some unannounced breaking changes on that gencode API in new releases of the plugin outside of our slow/rare/announced breaking change cadence. On Mon, Sep 15, 2025 at 9:37 AM Ranen Ghosh <[email protected]> wrote: > Hi, this isn't a question but I just wanted to leave this here in case it > saves someone time in the future: > > At first I couldn't figure out how to get complete upb code generation > output. I followed some "AI Overview" instructions which said to use > protoc's upb_out flag (which wasn't documented explicitly in the command > line help for protoc), but this resulted in a header "<protoname>.upb.h" > which contained an include for "<protoname>.upb_minitable.h", and the > second file was not generated. > > However this header file had some essential information in the comments > about how plugins work > > https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/command_line_interface.h#L141 > > // The compiler determines the executable name to search for by > concatenating > // exe_name_prefix with the unrecognized flag name, removing "_out". > So, for > // example, if exe_name_prefix is "protoc-" and you pass the flag > --foo_out, > // the compiler will try to run the program "protoc-gen-foo" > > The upb executables (on Windows) > are protoc-gen-upb.exe, protoc-gen-upb_minitable.exe, and > protoc-gen-upbdefs.exe, so I got working output with the command (with a > subdirectory "upb_out" to receive the output) > > ./protoc.exe --upb_out=upb_out --upb_minitable_out=upb_out > --upbdefs_out=upb_out myschema.proto > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/protobuf/66b6f841-8297-485e-8078-e6f333aae200n%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/66b6f841-8297-485e-8078-e6f333aae200n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/protobuf/CAKRmVH-435UvFB6%3D%3D-HbrGo3Qxo7Q3G7vU7QrGzD%3DB5sZBP4vg%40mail.gmail.com.
