@@ -37,17 +37,15 @@ var CBindingTemplate = template.Must(template.New("binding-c").Funcs(funcMap).Pa
3737#include "flatcc/flatcc_builder.h"
3838#include "objectbox.h"
3939
40- /// Internal function used in other generated functions to put (write) explicitly typed objects
40+ /// Internal function used in other generated functions to put (write) explicitly typed objects.
4141static obx_id {{.FileIdentifier}}_put_object(OBX_box* box, void* object,
4242 bool (*to_flatbuffer)(flatcc_builder_t*, const void*, void**, size_t*), OBXPutMode mode);
4343
44- /// Internal function used in other generated functions to get (read) explicitly typed objects
44+ /// Internal function used in other generated functions to get (read) explicitly typed objects.
4545static void* {{.FileIdentifier}}_get_object(OBX_box* box, obx_id id, void* (*from_flatbuffer)(const void*, size_t));
4646
47- flatbuffers_voffset_t {{.FileIdentifier}}_fb_field_offset(flatbuffers_voffset_t vs, const flatbuffers_voffset_t* vt,
48- size_t field) {
49- return (vs < sizeof(vt[0]) * (field + 3)) ? 0 : __flatbuffers_voffset_read_from_pe(vt + field + 2);
50- }
47+ /// Internal function used in other generated functions to get a vTable offset for a given field.
48+ static flatbuffers_voffset_t {{.FileIdentifier}}_fb_field_offset(flatbuffers_voffset_t vs, const flatbuffers_voffset_t* vt, size_t field);
5149
5250{{range $entity := .Model.EntitiesWithMeta}}
5351{{PrintComments 0 $entity.Comments}}typedef struct {{$entity.Meta.CName}} {
@@ -303,4 +301,8 @@ static void* {{.FileIdentifier}}_get_object(OBX_box* box, obx_id id, void* (*fro
303301 obx_txn_close(tx);
304302 return result;
305303}
304+
305+ static flatbuffers_voffset_t {{.FileIdentifier}}_fb_field_offset(flatbuffers_voffset_t vs, const flatbuffers_voffset_t* vt, size_t field) {
306+ return (vs < sizeof(vt[0]) * (field + 3)) ? 0 : __flatbuffers_voffset_read_from_pe(vt + field + 2);
307+ }
306308` ))
0 commit comments