diff options
author | Andrew Clayton <a.clayton@nginx.com> | 2023-10-26 22:43:46 +0100 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2023-10-26 22:51:19 +0100 |
commit | 4904aa341be9c74dec28e6eeea79b707211f2f06 (patch) | |
tree | 42666e982dc311b409f315a578e673664dce9d24 /c/wasmtime-basic/test.c | |
parent | 3aed80812e105cd99c43f11023012608aecd9f4a (diff) | |
download | project_blackbird-4904aa341be9c74dec28e6eeea79b707211f2f06.tar.gz project_blackbird-4904aa341be9c74dec28e6eeea79b707211f2f06.tar.bz2 |
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 <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r-- | c/wasmtime-basic/test.c | 26 |
1 files changed, 26 insertions, 0 deletions
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 <stdint.h> + +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; +} |