summaryrefslogtreecommitdiffstats
path: root/tests/run-make/static-dylib-by-default
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/static-dylib-by-default')
-rw-r--r--tests/run-make/static-dylib-by-default/Makefile17
-rw-r--r--tests/run-make/static-dylib-by-default/bar.rs8
-rw-r--r--tests/run-make/static-dylib-by-default/foo.rs4
-rw-r--r--tests/run-make/static-dylib-by-default/main.c6
4 files changed, 35 insertions, 0 deletions
diff --git a/tests/run-make/static-dylib-by-default/Makefile b/tests/run-make/static-dylib-by-default/Makefile
new file mode 100644
index 000000000..cdaab42d0
--- /dev/null
+++ b/tests/run-make/static-dylib-by-default/Makefile
@@ -0,0 +1,17 @@
+# ignore-cross-compile
+include ../tools.mk
+
+TO_LINK := $(call DYLIB,bar)
+ifdef IS_MSVC
+LINK_ARG = $(TO_LINK:dll=dll.lib)
+else
+LINK_ARG = $(TO_LINK)
+endif
+
+all:
+ $(RUSTC) foo.rs
+ $(RUSTC) bar.rs
+ $(CC) main.c $(call OUT_EXE,main) $(LINK_ARG) $(EXTRACFLAGS)
+ rm $(TMPDIR)/*.rlib
+ rm $(call DYLIB,foo)
+ $(call RUN,main)
diff --git a/tests/run-make/static-dylib-by-default/bar.rs b/tests/run-make/static-dylib-by-default/bar.rs
new file mode 100644
index 000000000..14421165e
--- /dev/null
+++ b/tests/run-make/static-dylib-by-default/bar.rs
@@ -0,0 +1,8 @@
+#![crate_type = "dylib"]
+
+extern crate foo;
+
+#[no_mangle]
+pub extern "C" fn bar() {
+ foo::foo();
+}
diff --git a/tests/run-make/static-dylib-by-default/foo.rs b/tests/run-make/static-dylib-by-default/foo.rs
new file mode 100644
index 000000000..7ebec8720
--- /dev/null
+++ b/tests/run-make/static-dylib-by-default/foo.rs
@@ -0,0 +1,4 @@
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+
+pub fn foo() {}
diff --git a/tests/run-make/static-dylib-by-default/main.c b/tests/run-make/static-dylib-by-default/main.c
new file mode 100644
index 000000000..5f7f2c27c
--- /dev/null
+++ b/tests/run-make/static-dylib-by-default/main.c
@@ -0,0 +1,6 @@
+extern void bar();
+
+int main() {
+ bar();
+ return 0;
+}