diff options
| author | Josh Wolfe <thejoshwolfe@gmail.com> | 2015-11-30 22:12:21 -0700 |
|---|---|---|
| committer | Josh Wolfe <thejoshwolfe@gmail.com> | 2015-11-30 22:12:21 -0700 |
| commit | 00f4c05784c05552e1e379b98c09161c936cfb31 (patch) | |
| tree | 5b2234cae585c5ac3a2cb23503908b0a6e2a27e3 /example | |
| parent | abbc3957019c3a12dacd54869ff18b91c3f07699 (diff) | |
| parent | 55b8472374eede496b59396dbe253b05b16063e1 (diff) | |
| download | zig-00f4c05784c05552e1e379b98c09161c936cfb31.tar.gz zig-00f4c05784c05552e1e379b98c09161c936cfb31.zip | |
merge conflicts
Diffstat (limited to 'example')
| -rw-r--r-- | example/hello_world/hello.zig (renamed from example/hello.zig) | 0 | ||||
| -rw-r--r-- | example/multiple_files/foo.zig | 5 | ||||
| -rw-r--r-- | example/multiple_files/libc.zig | 5 | ||||
| -rw-r--r-- | example/multiple_files/main.zig | 9 | ||||
| -rw-r--r-- | example/shared_library/mathtest.zig (renamed from example/mathtest.zig) | 0 | ||||
| -rw-r--r-- | example/shared_library/test.c | 7 |
6 files changed, 26 insertions, 0 deletions
diff --git a/example/hello.zig b/example/hello_world/hello.zig index d9efc46e96..d9efc46e96 100644 --- a/example/hello.zig +++ b/example/hello_world/hello.zig diff --git a/example/multiple_files/foo.zig b/example/multiple_files/foo.zig new file mode 100644 index 0000000000..aacc49a556 --- /dev/null +++ b/example/multiple_files/foo.zig @@ -0,0 +1,5 @@ +use "libc.zig"; + +fn print_text() { + puts("it works!"); +} diff --git a/example/multiple_files/libc.zig b/example/multiple_files/libc.zig new file mode 100644 index 0000000000..7d1a5bebd9 --- /dev/null +++ b/example/multiple_files/libc.zig @@ -0,0 +1,5 @@ +#link("c") +extern { + fn puts(s: *mut u8) -> i32; + fn exit(code: i32) -> unreachable; +} diff --git a/example/multiple_files/main.zig b/example/multiple_files/main.zig new file mode 100644 index 0000000000..993d4234c2 --- /dev/null +++ b/example/multiple_files/main.zig @@ -0,0 +1,9 @@ +export executable "test"; + +use "libc.zig"; +use "foo.zig"; + +fn _start() -> unreachable { + print_text(); + exit(0); +} diff --git a/example/mathtest.zig b/example/shared_library/mathtest.zig index 35ec901523..35ec901523 100644 --- a/example/mathtest.zig +++ b/example/shared_library/mathtest.zig diff --git a/example/shared_library/test.c b/example/shared_library/test.c new file mode 100644 index 0000000000..4fff250f08 --- /dev/null +++ b/example/shared_library/test.c @@ -0,0 +1,7 @@ +#include "mathtest.h" +#include <stdio.h> + +int main(int argc, char **argv) { + printf("%d\n", add(42, 1137)); + return 0; +} |
