Correction: the C binding only uses the generated code and some support header files
this was meant for the READ interface. The builder needs a proper runtime library consisting of builder.c and emitter.c files, and headers.
Correction2: JSON parsing comment unclear. What was meant is that the generated JSON parser is independent of generated C flatbuffer builder and reader support code and their implied use of the runtime library - instead the generated JSON parser calls the runtime builder library directly for its own purposes, similar to how any C based language extension could use the runtime builder library.
Here is a small snippet of generated JSON parser code that calls into the runtime library to build a vector as it is being parsed:
... parsers has detected a valid vector begins here, calls into the runtime library to start a vector, then iterates (while(more)) over
flatcc_builder_extend_vector to add elements to the vector as it is being parsed.
Not shown: finally the vector end method is called and the vectors is added as a a table field. One could similarly place calls in a given language extension doing something similar to build an array.
if (!flatcc_builder_start_vector(ctx->ctx, 1, 1, 0, 4294967295)) goto failed;
buf = flatcc_json_parser_array_start(ctx, buf, end, &more);
while (more) {
uint8_t val = 0;
static flatcc_json_parser_integral_symbol_f *symbolic_parsers[] = {
monster_test_local_MyGame_Example_json_parser_enum,
monster_test_global_json_parser_enum, 0 };
if (!(pval = flatcc_builder_extend_vector(ctx->ctx, 1))) goto failed;
...
JSON is simpler to show than C code because the C builder code is so heavy on macroes.