summaryrefslogtreecommitdiff
path: root/examples/bazel/test_binary.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-05-15 17:33:06 -0700
committerJoshua Haberman <jhaberman@gmail.com>2019-05-15 17:33:06 -0700
commit240bf641de10a056a048b9b7fa0de811a39bb707 (patch)
tree9f39652626744ab3eafd1bfe0820692da9fcdb48 /examples/bazel/test_binary.c
parent77600acc84be092dac7c58772e8ee01185c7405d (diff)
Working example dir for Bazel.
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