summaryrefslogtreecommitdiff
path: root/test/c-from-rust/clib
diff options
context:
space:
mode:
Diffstat (limited to 'test/c-from-rust/clib')
-rw-r--r--test/c-from-rust/clib/TARGETS19
-rw-r--r--test/c-from-rust/clib/bar.c5
-rw-r--r--test/c-from-rust/clib/bar.h3
-rw-r--r--test/c-from-rust/clib/foo.c5
-rw-r--r--test/c-from-rust/clib/foo.h3
5 files changed, 35 insertions, 0 deletions
diff --git a/test/c-from-rust/clib/TARGETS b/test/c-from-rust/clib/TARGETS
new file mode 100644
index 0000000..c72e90b
--- /dev/null
+++ b/test/c-from-rust/clib/TARGETS
@@ -0,0 +1,19 @@
+{ "foo":
+ { "type": ["@", "rules-cc", "CC", "library"]
+ , "pure C": ["true"]
+ , "name": ["foo"]
+ , "srcs": ["foo.c"]
+ , "hdrs": ["foo.h"]
+ , "stage": ["foo"]
+ , "deps": ["bar"]
+ }
+, "bar":
+ { "type": ["@", "rules-cc", "CC", "library"]
+ , "pure C": ["true"]
+ , "name": ["bar"]
+ , "srcs": ["bar.c"]
+ , "hdrs": ["bar.h"]
+ , "ldflags": ["-lm"]
+ , "stage": ["bar"]
+ }
+}
diff --git a/test/c-from-rust/clib/bar.c b/test/c-from-rust/clib/bar.c
new file mode 100644
index 0000000..5ad792c
--- /dev/null
+++ b/test/c-from-rust/clib/bar.c
@@ -0,0 +1,5 @@
+#include <math.h>
+
+int bar(int x){
+ return sqrt(x);
+}
diff --git a/test/c-from-rust/clib/bar.h b/test/c-from-rust/clib/bar.h
new file mode 100644
index 0000000..1c88e77
--- /dev/null
+++ b/test/c-from-rust/clib/bar.h
@@ -0,0 +1,3 @@
+#pragma once
+
+int bar(int);
diff --git a/test/c-from-rust/clib/foo.c b/test/c-from-rust/clib/foo.c
new file mode 100644
index 0000000..5306a9c
--- /dev/null
+++ b/test/c-from-rust/clib/foo.c
@@ -0,0 +1,5 @@
+#include "bar/bar.h"
+
+int c_func(int x){
+ return bar(x*x);
+}
diff --git a/test/c-from-rust/clib/foo.h b/test/c-from-rust/clib/foo.h
new file mode 100644
index 0000000..6ce2745
--- /dev/null
+++ b/test/c-from-rust/clib/foo.h
@@ -0,0 +1,3 @@
+#pragma once
+int c_func(int);
+