summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/raw-dylib-c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/run-make/raw-dylib-c/Makefile2
-rw-r--r--src/test/run-make/raw-dylib-c/extern_1.c12
-rw-r--r--src/test/run-make/raw-dylib-c/lib.rs13
-rw-r--r--src/test/run-make/raw-dylib-c/output.txt3
4 files changed, 28 insertions, 2 deletions
diff --git a/src/test/run-make/raw-dylib-c/Makefile b/src/test/run-make/raw-dylib-c/Makefile
index 713f66507..f47ab24f4 100644
--- a/src/test/run-make/raw-dylib-c/Makefile
+++ b/src/test/run-make/raw-dylib-c/Makefile
@@ -2,7 +2,7 @@
# only-windows
--include ../../run-make-fulldeps/tools.mk
+include ../../run-make-fulldeps/tools.mk
all:
$(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs
diff --git a/src/test/run-make/raw-dylib-c/extern_1.c b/src/test/run-make/raw-dylib-c/extern_1.c
index 72737c086..5d695547d 100644
--- a/src/test/run-make/raw-dylib-c/extern_1.c
+++ b/src/test/run-make/raw-dylib-c/extern_1.c
@@ -1,5 +1,7 @@
#include <stdio.h>
+__declspec(dllexport) int extern_variable = 0;
+
__declspec(dllexport) void extern_fn_1() {
printf("extern_fn_1\n");
fflush(stdout);
@@ -10,7 +12,17 @@ __declspec(dllexport) void extern_fn_2() {
fflush(stdout);
}
+__declspec(dllexport) void print_extern_variable() {
+ printf("extern_variable value: %d\n", extern_variable);
+ fflush(stdout);
+}
+
__declspec(dllexport) void extern_fn_with_long_name() {
printf("extern_fn_with_long_name; got the rename\n");
fflush(stdout);
}
+
+__declspec(dllexport) void extern_fn_4() {
+ printf("extern_fn_4\n");
+ fflush(stdout);
+}
diff --git a/src/test/run-make/raw-dylib-c/lib.rs b/src/test/run-make/raw-dylib-c/lib.rs
index 58f7ccb38..005ffcdda 100644
--- a/src/test/run-make/raw-dylib-c/lib.rs
+++ b/src/test/run-make/raw-dylib-c/lib.rs
@@ -12,12 +12,23 @@ extern {
pub fn library_function() {
#[link(name = "extern_1", kind = "raw-dylib")]
- extern { fn extern_fn_2(); }
+ extern {
+ fn extern_fn_2();
+ fn print_extern_variable();
+ static mut extern_variable: i32;
+ #[link_name = "extern_fn_4"]
+ fn extern_fn_4_renamed();
+ }
unsafe {
extern_fn_1();
extern_fn_2();
extern_fn_3();
+ extern_fn_4_renamed();
+ extern_variable = 42;
+ print_extern_variable();
+ extern_variable = -42;
+ print_extern_variable();
}
}
diff --git a/src/test/run-make/raw-dylib-c/output.txt b/src/test/run-make/raw-dylib-c/output.txt
index 7800cba18..cc970cef7 100644
--- a/src/test/run-make/raw-dylib-c/output.txt
+++ b/src/test/run-make/raw-dylib-c/output.txt
@@ -1,3 +1,6 @@
extern_fn_1
extern_fn_2; didn't get the rename
extern_fn_3
+extern_fn_4
+extern_variable value: 42
+extern_variable value: -42