A WebAssembly System Interface Implementation for Deno

栏目: IT技术 · 发布时间: 5年前

内容简介:This package provides an implementation of theThis is a work in progress so if a function isn't implemented, hit refresh.

WebAssembly System Interface implementation for Deno

This package provides an implementation of the WebAssembly System Interface for the Deno TypeScript runtime.

Status

This is a work in progress so if a function isn't implemented, hit refresh.

Name Status Notes
args_get
args_sizes_get
environ_get
environ_sizes_get
clock_res_get
clock_time_get
fd_advise This has no obvious path to implementation at this time.
fd_allocate This has no obvious path to implementation at this time.
fd_close
fd_datasync This is blocking on getting fdatasync(2) implemented upstream in Deno.
fd_fdstat_get This currently does not write flags and rights as we do not track those at the moment.
fd_fdstat_set_flags This has no obvious path to implementation at this time.
fd_fdstat_set_rights
fd_filestat_get This is blocking on getting fstat implemented upstream in Deno.
fd_filestat_set_size This is blocking on getting ftruncate implemented upstream in Deno.
fd_filestat_set_times
fd_pread
fd_prestat_get
fd_prestat_dir_name
fd_pwrite
fd_read
fd_readdir
fd_renumber
fd_seek
fd_sync This is blocking on getting fsync(2) implemented upstream in Deno.
fd_tell
fd_write
path_create_directory
path_filestat_get
path_filestat_set_times
path_link
path_open Opening directories is not portable
path_readlink
path_remove_directory
path_rename
path_symlink
path_unlink_file
poll_oneoff
proc_exit
proc_raise
sched_yield
random_get
sock_recv
sock_send
sock_shutdown

Example

import WASI from "https://deno.land/x/wasi/mod.ts";

const wasi = new WASI({
	args: Deno.args,
	env: Deno.env,
});

const binary = Deno.readAll("command.wasm");
const module = await WebAssembly.compile(binary);
const instance = await WebAssembly.instantiate(module, {
	wasi_snapshot_preview1: wasi.exports,
});

wasi.memory = module.exports.memory;

if (module.exports._start) {
	instance.exports._start();
} else if (module.exports._initialize) {
	instance.exports._initialize();
} else {
	throw new Error("No entry point found");
}

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

概率

概率

[俄]施利亚耶夫 / 周概容 / 高等教育出版社 / 2008-1 / 48.00元

《概率(第2卷)(修订和补充第3版)》是俄国著名数学家A.H.施利亚耶夫的力作。施利亚耶夫是现代概率论奠基人、前苏联科学院院士、著名数学家A.H.柯尔莫戈洛夫的学生,在概率统计界和金融数学界影响极大。《概率(第2卷)(修订和补充第3版)》作为莫斯科大学最为出色的概率教材之一。分为一、二两卷,并配有习题集。第二卷《概率(第2卷)(修订和补充第3版)》是离散时间随机过程(随机序列)的内容。重点讲述(强......一起来看看 《概率》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具