Skip to content

Commit

Permalink
add stubs for WASI preview 1 functions
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Pivkin <[email protected]>
  • Loading branch information
nikpivkin committed Nov 12, 2024
1 parent 0fc7c54 commit f067e67
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ export function generateWASIImports(instance: WapcHost): WebAssembly.ModuleImpor
return bytesWritten;
},

fd_close() { return 0 },
fd_fdstat_get() { return 0 },
fd_prestat_get() { return 0 },
fd_prestat_dir_name() { return 0 },
fd_read() { return 0 },
fd_seek() { return 0 },

path_open() { return 0 },

proc_exit() { return 0 },

args_sizes_get(argc: number, argvBufSize: number): number {
const memory = instance.getCallerMemory();
const dv = new DataView(memory.buffer);
Expand All @@ -147,5 +158,12 @@ export function generateWASIImports(instance: WapcHost): WebAssembly.ModuleImpor
args_get(argv: number, argvBuf: number): number {
return 0;
},

environ_sizes_get() { return 0 },
environ_get() { return 0 },

clock_time_get() { return 0; },

random_get() { return 0; }
};
}

0 comments on commit f067e67

Please sign in to comment.