File tree 3 files changed +20
-0
lines changed 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,7 @@ __wasilibc_fd_renumber
313
313
__wasilibc_find_abspath
314
314
__wasilibc_find_relpath
315
315
__wasilibc_find_relpath_alloc
316
+ __wasilibc_get_environ
316
317
__wasilibc_initialize_environ
317
318
__wasilibc_link
318
319
__wasilibc_link_newat
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ void __wasilibc_deinitialize_environ(void);
24
24
/// referenced in the program.
25
25
void __wasilibc_maybe_reinitialize_environ_eagerly (void );
26
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.
30
+ char * * __wasilibc_get_environ (void );
31
+
27
32
#ifdef __cplusplus
28
33
}
29
34
#endif
Original file line number Diff line number Diff line change
1
+ #include <wasi/libc-environ.h>
2
+
3
+ extern char * * __wasilibc_environ ;
4
+
5
+ // See the comments in libc-environ.h.
6
+ char * * __wasilibc_get_environ (void ) {
7
+ // Perform lazy initialization if needed.
8
+ __wasilibc_ensure_environ ();
9
+
10
+ // Return `environ`. Use the `__wasilibc_`-prefixed name so that we don't
11
+ // pull in the `environ` symbol directly, which would lead to eager
12
+ // initialization being done instead.
13
+ return __wasilibc_environ ;
14
+ }
You can’t perform that action at this time.
0 commit comments