summaryrefslogtreecommitdiff
path: root/examples/bazel/test_binary.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bazel/test_binary.c')
-rw-r--r--examples/bazel/test_binary.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/bazel/test_binary.c b/examples/bazel/test_binary.c
new file mode 100644
index 0000000..78f367a
--- /dev/null
+++ b/examples/bazel/test_binary.c
@@ -0,0 +1,17 @@
+
+#include <time.h>
+
+#include "foo.upb.h"
+
+int main() {
+ upb_arena *arena = upb_arena_new();
+ Foo* foo = Foo_new(arena);
+ const char greeting[] = "Hello, World!\n";
+
+ Foo_set_time(foo, time(NULL));
+ /* Warning: the proto will not copy this, the string data must outlive
+ * the proto. */
+ Foo_set_greeting(foo, upb_strview_makez(greeting));
+
+ upb_arena_free(arena);
+}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback