From 4904aa341be9c74dec28e6eeea79b707211f2f06 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Thu, 26 Oct 2023 22:43:46 +0100 Subject: Add a basic C based wasmtime runtime This can be used for creating an equivalent rust based runtime with C bindings. Signed-off-by: Andrew Clayton --- c/wasmtime-basic/test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 c/wasmtime-basic/test.c (limited to 'c/wasmtime-basic/test.c') diff --git a/c/wasmtime-basic/test.c b/c/wasmtime-basic/test.c new file mode 100644 index 0000000..f6e8723 --- /dev/null +++ b/c/wasmtime-basic/test.c @@ -0,0 +1,26 @@ +/* + * test.c + */ + +#include + +typedef uint32_t u32; +typedef uint8_t u8; + +__attribute__((import_module("env"), import_name("imported_func"))) +void imported_func(void); + +__attribute__((export_name("exported_func"))) +int exported_func(u8 *addr, u32 mem_size) +{ + (void)addr; + (void)mem_size; + imported_func(); + + return 0; +} + +int main(void) +{ + return 0; +} -- cgit