Skip to content

Commit e282b22

Browse files
committed
Document ARGV_INIT_ARRAY
1 parent 1ff055d commit e282b22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libstd/sys/unix/args.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ mod imp {
7878
ARGV = argv;
7979
}
8080

81+
/// glibc passes argc, argv, and envp to functions in .init_array, as a non-standard extension.
82+
/// This allows `std::env::args` to work even in a `cdylib`, as it does on macOS and Windows.
8183
#[cfg(all(target_os = "linux", target_env = "gnu"))]
8284
#[used]
8385
#[link_section = ".init_array.00099"]

0 commit comments

Comments
 (0)