diff options
Diffstat (limited to 'doc/interoperability/c-from-rust/foo')
-rw-r--r-- | doc/interoperability/c-from-rust/foo/TARGETS | 10 | ||||
-rw-r--r-- | doc/interoperability/c-from-rust/foo/foo.c | 7 | ||||
-rw-r--r-- | doc/interoperability/c-from-rust/foo/foo.h | 3 |
3 files changed, 20 insertions, 0 deletions
diff --git a/doc/interoperability/c-from-rust/foo/TARGETS b/doc/interoperability/c-from-rust/foo/TARGETS new file mode 100644 index 0000000..804b9e8 --- /dev/null +++ b/doc/interoperability/c-from-rust/foo/TARGETS @@ -0,0 +1,10 @@ +{ "foo": + { "type": ["@", "rules-cc", "CC", "library"] + , "pure C": ["true"] + , "name": ["foo"] + , "srcs": ["foo.c"] + , "hdrs": ["foo.h"] + , "stage": ["foo"] + , "ldflags": ["-lm"] + } +} diff --git a/doc/interoperability/c-from-rust/foo/foo.c b/doc/interoperability/c-from-rust/foo/foo.c new file mode 100644 index 0000000..e419fa4 --- /dev/null +++ b/doc/interoperability/c-from-rust/foo/foo.c @@ -0,0 +1,7 @@ +#include <math.h> + +#include "foo/foo.h" + +int c_func(int x){ + return sqrt(x*x); +} diff --git a/doc/interoperability/c-from-rust/foo/foo.h b/doc/interoperability/c-from-rust/foo/foo.h new file mode 100644 index 0000000..6ce2745 --- /dev/null +++ b/doc/interoperability/c-from-rust/foo/foo.h @@ -0,0 +1,3 @@ +#pragma once +int c_func(int); + |