File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,18 @@ mod imp {
72
72
// acquire this mutex reentrantly!
73
73
static LOCK : Mutex = Mutex :: new ( ) ;
74
74
75
- pub unsafe fn init ( argc : isize , argv : * const * const u8 ) {
75
+ unsafe fn really_init ( argc : isize , argv : * const * const u8 ) {
76
76
let _guard = LOCK . lock ( ) ;
77
77
ARGC = argc;
78
78
ARGV = argv;
79
79
}
80
80
81
+ #[ inline( always) ]
82
+ pub unsafe fn init ( _argc : isize , _argv : * const * const u8 ) {
83
+ #[ cfg( not( all( target_os = "linux" , target_env = "gnu" ) ) ) ]
84
+ really_init ( _argc, _argv) ;
85
+ }
86
+
81
87
/// glibc passes argc, argv, and envp to functions in .init_array, as a non-standard extension.
82
88
/// This allows `std::env::args` to work even in a `cdylib`, as it does on macOS and Windows.
83
89
#[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
@@ -94,7 +100,7 @@ mod imp {
94
100
_envp : * const * const u8 ,
95
101
) {
96
102
unsafe {
97
- init ( argc as isize , argv) ;
103
+ really_init ( argc as isize , argv) ;
98
104
}
99
105
}
100
106
init_wrapper
You can’t perform that action at this time.
0 commit comments