Wrap part of //aos:init for Rust
Just enough to run tests for now.
Change-Id: I714fbabfe713b34494a0a47a5679c409cce211c4
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
diff --git a/aos/init.cc b/aos/init.cc
index 3b298fa..9b00f1c 100644
--- a/aos/init.cc
+++ b/aos/init.cc
@@ -39,4 +39,25 @@
initialized = true;
}
+void InitFromRust(const char *argv0) {
+ CHECK(!IsInitialized()) << "Only initialize once.";
+
+ FLAGS_logtostderr = true;
+
+ google::InitGoogleLogging(argv0);
+
+ // TODO(Brian): Provide a way for Rust to configure C++ flags.
+ char fake_argv0_val[] = "rust";
+ char *fake_argv0 = fake_argv0_val;
+ char **fake_argv = &fake_argv0;
+ int fake_argc = 1;
+ gflags::ParseCommandLineFlags(&fake_argc, &fake_argv, true);
+
+ // TODO(Brian): Where should Rust binaries be configured to write coredumps?
+
+ // TODO(Brian): Figure out what to do with allocator hooks for C++ and Rust.
+
+ initialized = true;
+}
+
} // namespace aos