Skip to content
프로젝트

malcolmstill/zware has 415 GitHub stars and 23 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-23 23:04 UTC. Last push 2026-06-21.

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

소개

Zig WebAssembly Runtime Engine

웹 및 앱

README.md

Original

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..], .{});

    const result: i32 = @bitCast(@as(u32, @truncate(out[0])));
    std.debug.print("fib({}) = {}\n", .{ n, result });
}

Requirements

Compile-time

  • Zig 0.15.1 (master)

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

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 (not including SIMD tests)
  • Partial WASI support

Running tests

Use zig build --help to see all the test targets, here's a summary of the important ones:

zig build test      # Run all the tests (includes unittest and testsuite)
zig build unittest  # Run the library unittests
zig build testsuite # Run all the testsuite tests
zig build test-NAME # Run the NAME testsuite test, i.e. test-type

Does it run doom?

Yes, yes it does

https://github.com/malcolmstill/zware/assets/2567177/c9acdcb2-69e7-495f-b3f1-89cf6b807a43

관련 프로젝트 살펴보기

불러오는 중…