WACS.WASIp1
0.9.7
dotnet add package WACS.WASIp1 --version 0.9.7
NuGet\Install-Package WACS.WASIp1 -Version 0.9.7
<PackageReference Include="WACS.WASIp1" Version="0.9.7" />
<PackageVersion Include="WACS.WASIp1" Version="0.9.7" />
<PackageReference Include="WACS.WASIp1" />
paket add WACS.WASIp1 --version 0.9.7
#r "nuget: WACS.WASIp1, 0.9.7"
#:package WACS.WASIp1@0.9.7
#addin nuget:?package=WACS.WASIp1&version=0.9.7
#tool nuget:?package=WACS.WASIp1&version=0.9.7
WACS.WASIp1 for WACS
A C# implementation of WASI preview 1 for the WACS WebAssembly Interpreter.
Installation
Add the assembly from NuGet:
dotnet add package WACS.WASIp1
Usage Example
Here's a basic example demonstrating how to bind WASIp1 to the WACS WebAssembly runtime:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Wacs.Core;
using Wacs.Core.Runtime;
using Wacs.Core.WASIp1;
using Wacs.WASIp1.Types;
var runtime = new WasmRuntime();
var wasiConfig = new WasiConfiguration() {
StandardInput = System.Console.OpenStandardInput(),
StandardOutput = System.Console.OpenStandardOutput(),
StandardError = System.Console.OpenStandardError(),
Arguments = Environment.GetCommandLineArgs()
.Skip(1)
.ToList(),
EnvironmentVariables = Environment.GetEnvironmentVariables()
.Cast<DictionaryEntry>()
.ToDictionary(de => de.Key.ToString()!, de => de.Value?.ToString()??""),
HostRootDirectory = Directory.GetCurrentDirectory(),
};
var wasi = new WASIp1.Wasi(wasiConfig);
wasi.BindToRuntime(runtime);
using var fileStream = new FileStream("module.wasm", FileMode.Open);
var module = BinaryModuleParser.ParseWasm(fileStream);
var modInst = runtime.InstantiateModule(module);
runtime.RegisterModule("mymodule", modInst);
if (runtime.TryGetExportedFunction(("mymodule", "main"), out var mainAddr))
{
try
{
var mainInvoker = runtime.CreateInvoker<Func<Value>>(mainAddr);
int result = mainInvoker();
Console.Error.WriteLine($"mymodule.main() => {result}");
}
catch (TrapException exc)
{
System.Console.Error.WriteLine(exc);
return 1;
}
catch (SignalException exc)
{
System.Console.Error.WriteLine($"{exc.HumanReadable}");
return exc.Signal;
}
}
License
WACS is distributed under the Apache 2.0 License, allowing usage in both open-source and commercial projects.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
NuGet packages (1)
Showing the top 1 NuGet packages that depend on WACS.WASIp1:
| Package | Downloads |
|---|---|
|
Hako.Backend.WACS
A Hako backend which uses https://github.com/kelnishi/WACS, a WebAssembly runtime implemented in .NET Using this backend allows a .NET application using Hako to compile to any target where .NET is supported |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on WACS.WASIp1:
| Repository | Stars |
|---|---|
|
6over3/hako
An embeddable, lightweight, secure, high-performance JavaScript engine.
|