diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
commit | 2ff14448863ac1a1dd9533461708e29aae170c2d (patch) | |
tree | 85b9fea2bbfe3f06473cfa381eed11f273b57c5c /src/test/run-make/raw-dylib-c | |
parent | Adding debian version 1.64.0+dfsg1-1. (diff) | |
download | rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip |
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make/raw-dylib-c')
-rw-r--r-- | src/test/run-make/raw-dylib-c/Makefile | 2 | ||||
-rw-r--r-- | src/test/run-make/raw-dylib-c/extern_1.c | 12 | ||||
-rw-r--r-- | src/test/run-make/raw-dylib-c/lib.rs | 13 | ||||
-rw-r--r-- | src/test/run-make/raw-dylib-c/output.txt | 3 |
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 |