Skip to content

Commit c6bcea9

Browse files
committed
Test std::env::args in a staticlib on glibc Linux
1 parent d448ab0 commit c6bcea9

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# only-gnu
2+
# only-linux
3+
4+
-include ../tools.mk
5+
6+
# This ensures that std::env::args works in a library called from C on glibc Linux.
7+
8+
all:
9+
$(RUSTC) --crate-type=staticlib library.rs
10+
$(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) \
11+
$(EXTRACFLAGS) $(EXTRACXXFLAGS)
12+
$(call RUN,program)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[no_mangle]
2+
pub extern fn args_check() {
3+
assert_ne!(std::env::args_os().count(), 0);
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// ignore-license
2+
void args_check();
3+
4+
int main() {
5+
args_check();
6+
return 0;
7+
}

0 commit comments

Comments
 (0)