master
 1#ifndef __wasi_libc_environ_h
 2#define __wasi_libc_environ_h
 3
 4/// This header file is a WASI-libc-specific interface, and is not needed by
 5/// most programs. Most programs should just use the standard `getenv` and
 6/// related APIs, which take care of all of the details automatically.
 7
 8#ifdef __cplusplus
 9extern "C" {
10#endif
11
12/// Initialize the global environment variable state. Only needs to be
13/// called once; most users should call `__wasilibc_ensure_environ` instead.
14void __wasilibc_initialize_environ(void);
15
16/// If `__wasilibc_initialize_environ` has not yet been called, call it.
17void __wasilibc_ensure_environ(void);
18
19/// De-initialize the global environment variable state, so that subsequent
20/// calls to `__wasilibc_ensure_environ` call `__wasilibc_initialize_environ`.
21void __wasilibc_deinitialize_environ(void);
22
23/// Call `__wasilibc_initialize_environ` only if `environ` and `_environ` are
24/// referenced in the program.
25void __wasilibc_maybe_reinitialize_environ_eagerly(void);
26
27/// Return the value of the `environ` variable. Using `environ` directly
28/// requires eager initialization of the environment variables. Using this
29/// function instead of `environ` allows initialization to happen lazily.
30char **__wasilibc_get_environ(void);
31
32#ifdef __cplusplus
33}
34#endif
35
36#endif