aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/v/tests/project_with_c_code/mod1
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/vlib/v/tests/project_with_c_code/mod1')
-rw-r--r--v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/header.h10
-rw-r--r--v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/implementation.c5
-rw-r--r--v_windows/v/vlib/v/tests/project_with_c_code/mod1/v.mod5
-rw-r--r--v_windows/v/vlib/v/tests/project_with_c_code/mod1/wrapper.v17
4 files changed, 37 insertions, 0 deletions
diff --git a/v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/header.h b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/header.h
new file mode 100644
index 0000000..31489c3
--- /dev/null
+++ b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/header.h
@@ -0,0 +1,10 @@
+#ifndef ADD_H
+#define ADD_H
+
+int cadd(int a, int b);
+
+struct MyStruct {
+ int UppercaseField;
+};
+
+#endif
diff --git a/v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/implementation.c b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/implementation.c
new file mode 100644
index 0000000..03d7c94
--- /dev/null
+++ b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/c/implementation.c
@@ -0,0 +1,5 @@
+#include "header.h"
+
+int cadd(int a, int b) {
+ return a + b;
+}
diff --git a/v_windows/v/vlib/v/tests/project_with_c_code/mod1/v.mod b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/v.mod
new file mode 100644
index 0000000..72ddcfd
--- /dev/null
+++ b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/v.mod
@@ -0,0 +1,5 @@
+Module {
+ name: 'mod1',
+ description: 'A simple module, containing C code.',
+ dependencies: []
+}
diff --git a/v_windows/v/vlib/v/tests/project_with_c_code/mod1/wrapper.v b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/wrapper.v
new file mode 100644
index 0000000..f02233f
--- /dev/null
+++ b/v_windows/v/vlib/v/tests/project_with_c_code/mod1/wrapper.v
@@ -0,0 +1,17 @@
+module mod1
+
+#flag -I @VMODROOT/c
+#flag @VMODROOT/c/implementation.o
+
+#include "header.h"
+
+struct C.MyStruct {
+ UppercaseField int
+}
+
+fn C.cadd(int, int) int
+
+pub fn vadd(a int, b int) int {
+ x := C.MyStruct{100}
+ return 900 + x.UppercaseField + C.cadd(a, b)
+}