summaryrefslogtreecommitdiffstats
path: root/libc-top-half/headers/private/wasi/libc-environ-compat.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libc-top-half/headers/private/wasi/libc-environ-compat.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libc-top-half/headers/private/wasi/libc-environ-compat.h b/libc-top-half/headers/private/wasi/libc-environ-compat.h
new file mode 100644
index 0000000..fa2747d
--- /dev/null
+++ b/libc-top-half/headers/private/wasi/libc-environ-compat.h
@@ -0,0 +1,12 @@
+// This header file is meant to be included withinin the body of a function
+// which uses `__environ`. Code using `__environ` expects it will be initialized
+// eagerly. `__wasilibc_environ` is initialized lazily. Provide `__environ` as
+// an alias and arrange for the lazy initialization to be performed.
+
+extern char **__wasilibc_environ;
+
+__wasilibc_ensure_environ();
+
+#ifndef __wasilibc_environ
+#define __environ __wasilibc_environ
+#endif