summaryrefslogtreecommitdiffstats
path: root/test cases/rust/3 staticlib
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/rust/3 staticlib')
-rw-r--r--test cases/rust/3 staticlib/meson.build7
-rw-r--r--test cases/rust/3 staticlib/other.rs5
-rw-r--r--test cases/rust/3 staticlib/prog.rs5
-rw-r--r--test cases/rust/3 staticlib/stuff.rs14
-rw-r--r--test cases/rust/3 staticlib/test.json7
-rw-r--r--test cases/rust/3 staticlib/value.c5
6 files changed, 43 insertions, 0 deletions
diff --git a/test cases/rust/3 staticlib/meson.build b/test cases/rust/3 staticlib/meson.build
new file mode 100644
index 0000000..cf8e103
--- /dev/null
+++ b/test cases/rust/3 staticlib/meson.build
@@ -0,0 +1,7 @@
+project('rust static library', 'rust', 'c')
+
+o = static_library('other', 'other.rs')
+v = static_library('value', 'value.c')
+l = static_library('stuff', 'stuff.rs', link_whole : [o, v], install : true)
+e = executable('prog', 'prog.rs', link_with : l, install : true)
+test('linktest', e)
diff --git a/test cases/rust/3 staticlib/other.rs b/test cases/rust/3 staticlib/other.rs
new file mode 100644
index 0000000..037be33
--- /dev/null
+++ b/test cases/rust/3 staticlib/other.rs
@@ -0,0 +1,5 @@
+pub fn explore(
+ value: i32,
+) -> String {
+ format!("library{}string", value)
+}
diff --git a/test cases/rust/3 staticlib/prog.rs b/test cases/rust/3 staticlib/prog.rs
new file mode 100644
index 0000000..eee2653
--- /dev/null
+++ b/test cases/rust/3 staticlib/prog.rs
@@ -0,0 +1,5 @@
+extern crate stuff;
+
+fn main() {
+ println!("printing: {}", stuff::explore());
+}
diff --git a/test cases/rust/3 staticlib/stuff.rs b/test cases/rust/3 staticlib/stuff.rs
new file mode 100644
index 0000000..7cfcdff
--- /dev/null
+++ b/test cases/rust/3 staticlib/stuff.rs
@@ -0,0 +1,14 @@
+#![crate_name = "stuff"]
+
+extern crate other;
+
+extern "C" {
+ fn c_explore_value() -> i32;
+}
+
+pub fn explore(
+) -> String {
+ unsafe {
+ other::explore(c_explore_value())
+ }
+}
diff --git a/test cases/rust/3 staticlib/test.json b/test cases/rust/3 staticlib/test.json
new file mode 100644
index 0000000..ca29225
--- /dev/null
+++ b/test cases/rust/3 staticlib/test.json
@@ -0,0 +1,7 @@
+{
+ "installed": [
+ {"type": "exe", "file": "usr/bin/prog"},
+ {"type": "pdb", "file": "usr/bin/prog"},
+ {"type": "file", "file": "usr/lib/libstuff.rlib"}
+ ]
+}
diff --git a/test cases/rust/3 staticlib/value.c b/test cases/rust/3 staticlib/value.c
new file mode 100644
index 0000000..b71c806
--- /dev/null
+++ b/test cases/rust/3 staticlib/value.c
@@ -0,0 +1,5 @@
+int
+c_explore_value (void)
+{
+ return 42;
+}