From 240bf641de10a056a048b9b7fa0de811a39bb707 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 15 May 2019 17:33:06 -0700 Subject: Working example dir for Bazel. --- examples/bazel/test_binary.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/bazel/test_binary.c (limited to 'examples/bazel/test_binary.c') 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 + +#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); +} -- cgit v1.2.3