From 2af59c780363594236affb805c8320a590567bd9 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Sat, 26 Mar 2022 10:04:17 -0300 Subject: [PATCH] Use 'wasm_import_module' for LibWasi --- src/crystal/system/wasi/lib_wasi.cr | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/crystal/system/wasi/lib_wasi.cr b/src/crystal/system/wasi/lib_wasi.cr index a958b6e46206..a7714808dbb3 100644 --- a/src/crystal/system/wasi/lib_wasi.cr +++ b/src/crystal/system/wasi/lib_wasi.cr @@ -1,3 +1,4 @@ +@[Link(wasm_import_module: "wasi_snapshot_preview1")] lib LibWasi alias Fd = Int32 alias Size = UInt32 @@ -93,10 +94,10 @@ lib LibWasi d_type : FileType end - fun fd_prestat_get = __wasi_fd_prestat_get(fd : Fd, stat : Prestat*) : WasiError - fun fd_prestat_dir_name = __wasi_fd_prestat_dir_name(fd : Fd, path : UInt8*, len : Size) : WasiError - fun path_open = __wasi_path_open(fd : Fd, dirflags : LookupFlags, path : UInt8*, oflags : OpenFlags, fs_rights_base : Rights, fs_rights_inheriting : Rights, fdflags : FdFlags, ret : Fd*) : WasiError - fun fd_readdir = __wasi_fd_readdir(fd : Fd, buf : UInt8*, len : Size, cookie : UInt64, ret : Size*) : WasiError - fun fd_close = __wasi_fd_close(fd : Fd) : WasiError - fun random_get = __wasi_random_get(buf : UInt8*, len : Size) : WasiError + fun fd_prestat_get(fd : Fd, stat : Prestat*) : WasiError + fun fd_prestat_dir_name(fd : Fd, path : UInt8*, len : Size) : WasiError + fun path_open(fd : Fd, dirflags : LookupFlags, path : UInt8*, oflags : OpenFlags, fs_rights_base : Rights, fs_rights_inheriting : Rights, fdflags : FdFlags, ret : Fd*) : WasiError + fun fd_readdir(fd : Fd, buf : UInt8*, len : Size, cookie : UInt64, ret : Size*) : WasiError + fun fd_close(fd : Fd) : WasiError + fun random_get(buf : UInt8*, len : Size) : WasiError end