diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2019-05-15 17:33:06 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2019-05-15 17:33:06 -0700 |
commit | 240bf641de10a056a048b9b7fa0de811a39bb707 (patch) | |
tree | 9f39652626744ab3eafd1bfe0820692da9fcdb48 /examples/bazel/test_binary.c | |
parent | 77600acc84be092dac7c58772e8ee01185c7405d (diff) |
Working example dir for Bazel.
Diffstat (limited to 'examples/bazel/test_binary.c')
-rw-r--r-- | examples/bazel/test_binary.c | 17 |
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); +} |