aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hello_world_c_zig/.gitignore (renamed from examples/hello_world/.gitignore)0
-rw-r--r--examples/hello_world_c_zig/project.conf8
-rw-r--r--examples/hello_world_c_zig/src/foo.zig8
-rw-r--r--examples/hello_world_c_zig/src/main.c14
-rw-r--r--examples/hello_world_c_zig/tests/main.c7
-rw-r--r--examples/hello_world_cpp/.gitignore5
-rw-r--r--examples/hello_world_cpp/project.conf (renamed from examples/hello_world/project.conf)0
-rw-r--r--examples/hello_world_cpp/src/main.cpp (renamed from examples/hello_world/src/main.cpp)0
-rw-r--r--examples/hello_world_cpp/tests/main.cpp (renamed from examples/hello_world/tests/main.cpp)0
-rw-r--r--examples/hello_world_zig/.gitignore5
-rw-r--r--examples/hello_world_zig/project.conf5
-rw-r--r--examples/hello_world_zig/src/main.zig6
12 files changed, 58 insertions, 0 deletions
diff --git a/examples/hello_world/.gitignore b/examples/hello_world_c_zig/.gitignore
index 636c6b9..636c6b9 100644
--- a/examples/hello_world/.gitignore
+++ b/examples/hello_world_c_zig/.gitignore
diff --git a/examples/hello_world_c_zig/project.conf b/examples/hello_world_c_zig/project.conf
new file mode 100644
index 0000000..fa006cd
--- /dev/null
+++ b/examples/hello_world_c_zig/project.conf
@@ -0,0 +1,8 @@
+[package]
+name = "hello_world_c_zig"
+type = "executable"
+version = "0.1.0"
+platforms = ["linux64"]
+tests = "tests"
+
+[dependencies]
diff --git a/examples/hello_world_c_zig/src/foo.zig b/examples/hello_world_c_zig/src/foo.zig
new file mode 100644
index 0000000..464eadd
--- /dev/null
+++ b/examples/hello_world_c_zig/src/foo.zig
@@ -0,0 +1,8 @@
+const warn = @import("std").debug.warn;
+
+extern fn baz() void;
+
+export fn foo() void {
+ warn("zig called from c!\n");
+ baz();
+}
diff --git a/examples/hello_world_c_zig/src/main.c b/examples/hello_world_c_zig/src/main.c
new file mode 100644
index 0000000..aeaeae4
--- /dev/null
+++ b/examples/hello_world_c_zig/src/main.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <zig/src/foo.h>
+
+void baz()
+{
+ printf("c called from zig!\n");
+}
+
+int main(int argc, char **argv)
+{
+ printf("inside c\n");
+ foo();
+ return 0;
+}
diff --git a/examples/hello_world_c_zig/tests/main.c b/examples/hello_world_c_zig/tests/main.c
new file mode 100644
index 0000000..9ad80a6
--- /dev/null
+++ b/examples/hello_world_c_zig/tests/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ printf("hello, world!\n");
+ return 0;
+}
diff --git a/examples/hello_world_cpp/.gitignore b/examples/hello_world_cpp/.gitignore
new file mode 100644
index 0000000..636c6b9
--- /dev/null
+++ b/examples/hello_world_cpp/.gitignore
@@ -0,0 +1,5 @@
+# Compiled sibs files
+sibs-build/
+compile_commands.json
+tests/sibs-build/
+tests/compile_commands.json
diff --git a/examples/hello_world/project.conf b/examples/hello_world_cpp/project.conf
index 4c05ce5..4c05ce5 100644
--- a/examples/hello_world/project.conf
+++ b/examples/hello_world_cpp/project.conf
diff --git a/examples/hello_world/src/main.cpp b/examples/hello_world_cpp/src/main.cpp
index 28bab08..28bab08 100644
--- a/examples/hello_world/src/main.cpp
+++ b/examples/hello_world_cpp/src/main.cpp
diff --git a/examples/hello_world/tests/main.cpp b/examples/hello_world_cpp/tests/main.cpp
index 28bab08..28bab08 100644
--- a/examples/hello_world/tests/main.cpp
+++ b/examples/hello_world_cpp/tests/main.cpp
diff --git a/examples/hello_world_zig/.gitignore b/examples/hello_world_zig/.gitignore
new file mode 100644
index 0000000..636c6b9
--- /dev/null
+++ b/examples/hello_world_zig/.gitignore
@@ -0,0 +1,5 @@
+# Compiled sibs files
+sibs-build/
+compile_commands.json
+tests/sibs-build/
+tests/compile_commands.json
diff --git a/examples/hello_world_zig/project.conf b/examples/hello_world_zig/project.conf
new file mode 100644
index 0000000..6ad2e1b
--- /dev/null
+++ b/examples/hello_world_zig/project.conf
@@ -0,0 +1,5 @@
+[package]
+name = "hello_world_zig"
+type = "executable"
+version = "0.1.0"
+platforms = ["any"]
diff --git a/examples/hello_world_zig/src/main.zig b/examples/hello_world_zig/src/main.zig
new file mode 100644
index 0000000..c74a3de
--- /dev/null
+++ b/examples/hello_world_zig/src/main.zig
@@ -0,0 +1,6 @@
+const warn = @import("std").debug.warn;
+
+pub fn main() void
+{
+ warn("Hello, world!\n");
+}