From 7d76b7679d0b70b0e38ff08aeeeb78acde14aac3 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 25 Jan 2025 17:35:10 +0000 Subject: Use generated C headers in runtime --- runtime/src/shed/namespaces/Std/Process.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 runtime/src/shed/namespaces/Std/Process.c (limited to 'runtime/src/shed/namespaces/Std/Process.c') diff --git a/runtime/src/shed/namespaces/Std/Process.c b/runtime/src/shed/namespaces/Std/Process.c new file mode 100644 index 00000000..88fa9b6d --- /dev/null +++ b/runtime/src/shed/namespaces/Std/Process.c @@ -0,0 +1,34 @@ +#include "../../std/unistd.h" + +#include "../../shed.h" +#include "./Process.h" + +#ifdef __wasm__ + +void wasi_proc_exit(uint32_t exitcode) + __attribute__(( + __import_module__("wasi_snapshot_preview1"), + __import_name__("proc_exit"), + )); + +ShedObject shed__runtime__namespace__Std__Process__exit( + ShedClosurePointer closurePointer, + ShedObject exitCode +) { + wasi_proc_exit(shed__runtime__int_value(exitCode)); + return shed_unit; +} + +#else + +#include + +ShedObject shed__runtime__namespace__Std__Process__exit( + ShedClosurePointer closurePointer, + ShedObject exitCode +) { + exit(shed__runtime__int_value(exitCode)); + return shed_unit; +} + +#endif -- cgit v1.2.3