1
Fork 0

Test std::env::args in a staticlib on glibc Linux

This commit is contained in:
leo60228 2019-11-21 14:03:31 -05:00
parent d448ab0cf1
commit c6bcea965d
3 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# only-gnu
# only-linux
-include ../tools.mk
# This ensures that std::env::args works in a library called from C on glibc Linux.
all:
$(RUSTC) --crate-type=staticlib library.rs
$(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) \
$(EXTRACFLAGS) $(EXTRACXXFLAGS)
$(call RUN,program)

View file

@ -0,0 +1,4 @@
#[no_mangle]
pub extern fn args_check() {
assert_ne!(std::env::args_os().count(), 0);
}

View file

@ -0,0 +1,7 @@
// ignore-license
void args_check();
int main() {
args_check();
return 0;
}