]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/headers/public/wasi/libc-environ.h
Add a function to de-initialize the environment-variable state.
[wasi-libc.git] / libc-bottom-half / headers / public / wasi / libc-environ.h
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
9 extern "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.
14 void __wasilibc_initialize_environ(void);
15
16 /// If `__wasilibc_initialize_environ` has not yet been called, call it.
17 void __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`.
21 void __wasilibc_deinitialize_environ(void);
22
23 /// Call `__wasilibc_initialize_environ` only if `environ` and `_environ` are
24 /// referenced in the program.
25 void __wasilibc_maybe_reinitialize_environ_eagerly(void);
26
27 #ifdef __cplusplus
28 }
29 #endif
30
31 #endif