All Projects → malcolmstill → foxwren

malcolmstill / foxwren

Licence: MIT license
Zig WebAssembly Runtime Engine

Programming Languages

Zig
133 projects
WebAssembly
147 projects
shell
77523 projects

Projects that are alternatives of or similar to foxwren

zlm
Zig linear mathemathics
Stars: ✭ 67 (-46.83%)
Mutual labels:  ziglang
zig-args
Simple-to-use argument parser with struct-based config
Stars: ✭ 106 (-15.87%)
Mutual labels:  ziglang
ansi-term
Zig library for dealing with ANSI terminals
Stars: ✭ 25 (-80.16%)
Mutual labels:  ziglang
zetaframe
lightweight zig game framework.
Stars: ✭ 14 (-88.89%)
Mutual labels:  ziglang
IUPforZig
IUP (Portable User Interface Toolkit) bindings for the Zig language.
Stars: ✭ 56 (-55.56%)
Mutual labels:  ziglang
SDL.zig
A shallow wrapper around SDL that provides object API and error handling
Stars: ✭ 102 (-19.05%)
Mutual labels:  ziglang
colorstorm
A color theme generator for editors and terminal emulators
Stars: ✭ 101 (-19.84%)
Mutual labels:  ziglang
zig-opengl
OpenGL binding generator based on the opengl registry
Stars: ✭ 29 (-76.98%)
Mutual labels:  ziglang
qml zig
QML bindings for the Zig programming language
Stars: ✭ 25 (-80.16%)
Mutual labels:  ziglang
zero-graphics
Application framework based on OpenGL ES 2.0. Runs on desktop machines, Android phones and the web
Stars: ✭ 72 (-42.86%)
Mutual labels:  ziglang
spu-mark-ii
CPU and home computer project
Stars: ✭ 14 (-88.89%)
Mutual labels:  ziglang
georgios
Hobby Operating System
Stars: ✭ 19 (-84.92%)
Mutual labels:  ziglang
zwld
Experimental wasm linker
Stars: ✭ 37 (-70.63%)
Mutual labels:  ziglang
zig-gamedev
Building game development ecosystem for @ziglang!
Stars: ✭ 1,059 (+740.48%)
Mutual labels:  ziglang
luf
Statically typed, embeddable, scripting language written in Zig.
Stars: ✭ 26 (-79.37%)
Mutual labels:  ziglang
zalgebra
Linear algebra library for games and real-time graphics.
Stars: ✭ 129 (+2.38%)
Mutual labels:  ziglang
mach-glfw
Ziggified GLFW bindings with 100% API coverage, zero-fuss installation, cross compilation, and more.
Stars: ✭ 186 (+47.62%)
Mutual labels:  ziglang

zware

WebAssembly logo: a purple-blue square containing the uppercase letters W A. The square has a semicirclular notch on the top edge in the middle
Zig WebAssembly Runtime Engine

About

zware is a library for executing WebAssembly embedded in Zig programs.

Example

From examples/fib:

const std = @import("std");
const zware = @import("zware");
const Store = zware.Store;
const Module = zware.Module;
const Instance = zware.Instance;
const GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator;
var gpa = GeneralPurposeAllocator(.{}){};

pub fn main() !void {
    defer _ = gpa.deinit();
    const alloc = gpa.allocator();

    const bytes = @embedFile("fib.wasm");

    var store = Store.init(alloc);
    defer store.deinit();

    var module = Module.init(alloc, bytes);
    defer module.deinit();
    try module.decode();

    var instance = Instance.init(alloc, &store, module);
    try instance.instantiate();
    defer instance.deinit();

    const n = 39;
    var in = [1]u64{n};
    var out = [1]u64{0};
    try instance.invoke("fib", in[0..], out[0..], .{});
    std.debug.print("fib({}) = {}\n", .{ n, @bitCast(i32, @truncate(u32, out[0])) });
}

Requirements

Compile-time

  • Zig 0.10.0

Run-time

  • None, zig generates static binaries:
➜  zware git:(master) ✗ ldd fib
        not a dynamic executable

Goals

  • Embed WebAssembly programs in other zig programs
  • Be fast enough to be useful
  • Implement WASI

Status

  • The project is very much alpha quality
  • WebAssembly 2.0 supported (apart from the vector / SIMD support which is WIP)
  • The WebAssembly official testsuite passes and zware includes a fuzzer

Running the testsuite

  1. Build the test runner
zig build --build-file test/testrunner/build.zig --prefix ./
  1. Run
sh test/run-generated.sh
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].