{"id":13626633,"url":"https://github.com/malcolmstill/zware","last_synced_at":"2025-05-16T12:09:33.822Z","repository":{"id":37024577,"uuid":"334829594","full_name":"malcolmstill/zware","owner":"malcolmstill","description":"Zig WebAssembly Runtime Engine","archived":false,"fork":false,"pushed_at":"2024-10-20T20:04:48.000Z","size":3276,"stargazers_count":317,"open_issues_count":15,"forks_count":13,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-26T08:01:51.935Z","etag":null,"topics":["wasm","webassembly","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/malcolmstill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-01T04:27:54.000Z","updated_at":"2025-02-27T18:29:49.000Z","dependencies_parsed_at":"2024-06-15T14:40:33.265Z","dependency_job_id":"484f3b0e-eb63-4928-83a1-594cb7c6cd1f","html_url":"https://github.com/malcolmstill/zware","commit_stats":null,"previous_names":["malcolmstill/foxwren"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fzware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fzware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fzware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fzware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malcolmstill","download_url":"https://codeload.github.com/malcolmstill/zware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246777832,"owners_count":20832032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wasm","webassembly","zig","zig-package","ziglang"],"created_at":"2024-08-01T21:02:25.314Z","updated_at":"2025-04-02T09:01:38.547Z","avatar_url":"https://github.com/malcolmstill.png","language":"Zig","readme":"\u003ch1 align=\"center\"\u003ezware\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/malcolmstill/web-assembly-logo/blob/master/dist/icon/web-assembly-icon-128px.png\" alt=\"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\" /\u003e\n  \u003cbr /\u003e\n  \u003cstrong\u003eZig WebAssembly Runtime Engine\u003c/strong\u003e\n\u003c/div\u003e\n\n## About\n\n`zware` is a library for executing WebAssembly embedded in [Zig](https://ziglang.org) programs.\n\n## Example\n\nFrom `examples/fib`:\n\n```zig\nconst std = @import(\"std\");\nconst zware = @import(\"zware\");\nconst Store = zware.Store;\nconst Module = zware.Module;\nconst Instance = zware.Instance;\nconst GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator;\nvar gpa = GeneralPurposeAllocator(.{}){};\n\npub fn main() !void {\n    defer _ = gpa.deinit();\n    const alloc = gpa.allocator();\n\n    const bytes = @embedFile(\"fib.wasm\");\n\n    var store = Store.init(alloc);\n    defer store.deinit();\n\n    var module = Module.init(alloc, bytes);\n    defer module.deinit();\n    try module.decode();\n\n    var instance = Instance.init(alloc, \u0026store, module);\n    try instance.instantiate();\n    defer instance.deinit();\n\n    const n = 39;\n    var in = [1]u64{n};\n    var out = [1]u64{0};\n\n    try instance.invoke(\"fib\", in[0..], out[0..], .{});\n\n    const result: i32 = @bitCast(@as(u32, @truncate(out[0])));\n    std.debug.print(\"fib({}) = {}\\n\", .{ n, result });\n}\n```\n\n## Requirements\n\n### Compile-time\n\n- Zig 0.12 (master)\n\n### Run-time\n\n- None, zig generates static binaries:\n\n```bash\n➜  zware git:(master) ✗ ldd fib\n        not a dynamic executable\n```\n\n## Goals\n\n- Embed WebAssembly programs in other zig programs\n- Be fast enough to be useful\n\n## Status\n\n- The project is very much alpha quality\n- WebAssembly 2.0 supported (apart from the vector / SIMD support which is WIP)\n- The WebAssembly official testsuite passes (not including SIMD tests)\n- Partial WASI support\n\n## Running tests\n\nUse `zig build --help` to see all the test targets, here's a summary of the important ones:\n\n```sh\nzig build test      # Run all the tests (includes unittest and testsuite)\nzig build unittest  # Run the library unittests\nzig build testsuite # Run all the testsuite tests\nzig build test-NAME # Run the NAME testsuite test, i.e. test-type\n```\n\n## Does it run doom?\n\nYes, [yes it does](https://github.com/malcolmstill/zware-doom)\n\nhttps://github.com/malcolmstill/zware/assets/2567177/c9acdcb2-69e7-495f-b3f1-89cf6b807a43\n","funding_links":[],"categories":["Zig","Network \u0026 Web"],"sub_categories":["WebAssembly"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcolmstill%2Fzware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalcolmstill%2Fzware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcolmstill%2Fzware/lists"}