{"id":13829479,"url":"https://github.com/wapc/wapc-guest-zig","last_synced_at":"2025-10-07T04:08:50.317Z","repository":{"id":35463239,"uuid":"207880856","full_name":"wapc/wapc-guest-zig","owner":"wapc","description":"SDK for creating waPC WebAssembly Guest Modules in Zig","archived":false,"fork":false,"pushed_at":"2021-12-27T21:33:31.000Z","size":8,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-20T11:17:11.082Z","etag":null,"topics":["sdk","wasm","webassembly","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wapc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-11T18:33:25.000Z","updated_at":"2023-10-04T13:16:24.000Z","dependencies_parsed_at":"2022-09-19T10:20:44.931Z","dependency_job_id":null,"html_url":"https://github.com/wapc/wapc-guest-zig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wapc/wapc-guest-zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapc%2Fwapc-guest-zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapc%2Fwapc-guest-zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapc%2Fwapc-guest-zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapc%2Fwapc-guest-zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wapc","download_url":"https://codeload.github.com/wapc/wapc-guest-zig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapc%2Fwapc-guest-zig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264439963,"owners_count":23608614,"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":["sdk","wasm","webassembly","zig","ziglang"],"created_at":"2024-08-04T10:00:37.413Z","updated_at":"2025-10-07T04:08:45.255Z","avatar_url":"https://github.com/wapc.png","language":"Zig","funding_links":[],"categories":["Misc"],"sub_categories":[],"readme":"# waPC Guest Library for Zig\n\nThis is the Zig implementation of the **waPC** standard for WebAssembly guest modules. It allows any waPC-compliant WebAssembly host to invoke to procedures inside a Zig compiled guest and similarly for the guest to invoke procedures exposed by the host.\n\n## Example\nThe following is a simple example of synchronous, bi-directional procedure calls between a WebAssembly host runtime and the guest module.\n\n`hello.zig` (copy `wapc.zig` into the same directory)\n\n```zig\nconst wapc = @import(\"wapc.zig\");\nconst std = @import(\"std\");\nconst mem = std.mem;\n\nexport fn __guest_call(operation_size: usize, payload_size: usize) bool {\n    return wapc.handleCall(operation_size, payload_size, \u0026functions);\n}\n\nvar functions = [_]wapc.Function{\n    wapc.Function{.name = \u0026\"hello\", .invoke = sayHello},\n};\n\nfn sayHello(allocator: *mem.Allocator, payload: []u8) ![]u8 {\n    const hostHello = try wapc.hostCall(allocator, \u0026\"myBinding\", \u0026\"sample\", \u0026\"hello\", \u0026\"Simon\");\n    const prefix = \"Hello, \";\n    const message = try allocator.alloc(u8, prefix.len + payload.len + hostHello.len + 1);\n    mem.copy(u8, message, \u0026prefix);\n    mem.copy(u8, message[prefix.len..], payload);\n    mem.copy(u8, message[prefix.len+payload.len..], hostHello);\n    message[message.len-1] = '!';\n    return message;\n}\n```\n\n```sh\nzig build-lib hello.zig -target wasm32-freestanding\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwapc%2Fwapc-guest-zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwapc%2Fwapc-guest-zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwapc%2Fwapc-guest-zig/lists"}