summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp
new file mode 100644
index 000000000..11e70af1f
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp
@@ -0,0 +1,45 @@
+#include <cstdlib>
+#include <cstdio>
+#include <iostream>
+
+static void
+bye_setup()
+{
+ std::cout << "mE " << __FUNCTION__ << std::endl;
+}
+
+static void
+bye_func()
+{
+ std::cout << "mE " << __FUNCTION__ << std::endl;
+}
+
+__attribute__((constructor)) void
+setup()
+{
+ std::cout << "mE " << __FUNCTION__ << std::endl;
+ if (std::atexit(bye_setup) != 0) {
+ std::perror("register an atexit handler failed");
+ }
+}
+
+__attribute__((destructor)) void
+teardown()
+{
+ std::cout << "mE " << __FUNCTION__ << std::endl;
+}
+
+__attribute__((export_name("func1"))) void
+func1()
+{
+ std::cout << "mE " << __FUNCTION__ << std::endl;
+ if (std::atexit(bye_func) != 0) {
+ std::perror("register an atexit handler failed");
+ }
+}
+
+__attribute__((export_name("func2"))) void
+func2()
+{
+ std::cout << "mE " << __FUNCTION__ << std::endl;
+}