{"id":18016557,"url":"https://github.com/webassembly/wasm-c-api","last_synced_at":"2025-10-08T22:27:23.037Z","repository":{"id":33594500,"uuid":"135301410","full_name":"WebAssembly/wasm-c-api","owner":"WebAssembly","description":"Wasm C API prototype","archived":false,"fork":false,"pushed_at":"2025-01-17T09:01:32.000Z","size":578,"stargazers_count":572,"open_issues_count":59,"forks_count":81,"subscribers_count":60,"default_branch":"main","last_synced_at":"2025-05-29T11:23:09.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/WebAssembly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-05-29T13:36:29.000Z","updated_at":"2025-05-14T14:28:52.000Z","dependencies_parsed_at":"2025-01-26T00:02:38.848Z","dependency_job_id":"fc738acb-471e-480c-a8df-235719cdfef9","html_url":"https://github.com/WebAssembly/wasm-c-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WebAssembly/wasm-c-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebAssembly%2Fwasm-c-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebAssembly%2Fwasm-c-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebAssembly%2Fwasm-c-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebAssembly%2Fwasm-c-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebAssembly","download_url":"https://codeload.github.com/WebAssembly/wasm-c-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebAssembly%2Fwasm-c-api/sbom","scorecard":{"id":150197,"data":{"date":"2025-08-11","repo":{"name":"github.com/WebAssembly/wasm-c-api","commit":"debd0908627e3028b1aa460a4934732c2c3b00a6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":0,"reason":"binaries present in source code","details":["Warn: binary detected: example/callback.wasm:1","Warn: binary detected: example/finalize.wasm:1","Warn: binary detected: example/global.wasm:1","Warn: binary detected: example/hello.wasm:1","Warn: binary detected: example/hostref.wasm:1","Warn: binary detected: example/memory.wasm:1","Warn: binary detected: example/multi.wasm:1","Warn: binary detected: example/reflect.wasm:1","Warn: binary detected: example/serialize.wasm:1","Warn: binary detected: example/start.wasm:1","Warn: binary detected: example/table.wasm:1","Warn: binary detected: example/threads.wasm:1","Warn: binary detected: example/trap.wasm:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":3,"reason":"Found 11/30 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/WebAssembly/wasm-c-api/main.yml/main?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating ubuntu:bionic to ubuntu:bionic@sha256:152dc042452c496007f07ca9127571cb9c29697f42acbfad72324b2bb2e43c98","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T10:25:45.109Z","repository_id":33594500,"created_at":"2025-08-16T10:25:45.109Z","updated_at":"2025-08-16T10:25:45.109Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000782,"owners_count":26082851,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-30T04:18:27.541Z","updated_at":"2025-10-08T22:27:23.021Z","avatar_url":"https://github.com/WebAssembly.png","language":"C++","readme":"# WebAssembly C and C++ API \n\nWork in progress! No docs yet.\n\n\n### Design Goals\n\n* Provide a \"black box\" API for embedding a Wasm engine in other C/C++ applications.\n\n  * Be completely agnostic to VM specifics.\n\n  * Non-goal: \"white box\" interoperability with embedder (such as combined GC instead of mere finalisation) -- *much* more difficult to achieve.\n\n* Allow creation of bindings for other languages through typical C foreign function interfaces.\n\n  * Support a plain C API.\n\n  * Stick to mostly manual memory management of interface objects.\n\n* Avoid language features that raise barrier to use.\n\n  * E.g., no exceptions or post-C++11 features in C++ API.\n\n  * E.g., no passing of structs by-value or post-C99 features in C API.\n\n* Achieve link-time compatibility between different implementations.\n\n  * All implementation-dependent API classes are abstract and can be instantiated through factory methods only.\n\n\n### Interfaces\n\n* C++ API:\n\n  * See `include/wasm.hh` for interface.\n\n  * See `example/*.cc` for example usages.\n\n* C API:\n\n  * See `include/wasm.h` for interface.\n\n  * See `example/*.c` for example usages.\n\nSome random explanations:\n\n* The VM must be initialised by creating an instance of an *engine* (`wasm::Engine`/`wasm_engine_t`) and is shut down by deleting it. Such an instance may only be created once per process.\n\n* All runtime objects are tied to a specific *store* (`wasm::Store`/`wasm_store_t`). Multiple stores can be created, but their objects cannot interact. Every store and its objects must only be accessed in a single thread.\n\n* To exchange module objects between threads, create a *shared* module (`wasm::Shared\u003cModule\u003e`/`wasm_shared_module_t`). Other objects cannot be shared in current Wasm.\n\n* *Vector* structures (`wasm::vec\u003cX\u003e`/`wasm_x_vec_t`) are lightweight abstractions of a pair of a plain array and its length. The C++ API does not use `std::vector` because that does not support adopting pre-existing arrays.\n\n* *References* point to runtime objects, but may involve internal indirections, which may or may not be cached. Thus, pointer equality on `Ref*` or subclasses cannot be used to compare identity of the underlying objects (`Ref::eq` may be added later). However, `nullptr`/`NULL` uniquely represents null references.\n\n* The API already encompasses current proposals like [multiple return values](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md) and [reference types](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md), but not yet [threads](https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md).\n\n\n### Prototype Implementation\n\n* This repo contains a prototype implementation based on V8 is in `src`.\n\n  * Note that this requires adding a module to V8, so it patches V8's build file.\n\n* The C API is implemented on top of the C++ API.\n\n* See `Makefile` for build recipe. Canonical steps to run examples:\n\n  1. `make v8-checkout`\n  2. `make v8`\n  3. `make all`\n\n\n#### Limitations\n\nV8 implementation:\n\n* Currently requires patching V8 by adding a module.\n\n* Host functions (`Func::make`) create a JavaScript function internally, since V8 cannot handle raw C imports yet.\n\n* As a consequence, does not support multiple results in external calls or host functions.\n\n* Host functions and host globals are created through auxiliary modules constructed on the fly, to work around limitations in JS API.\n\n* `Shared\u003cModule\u003e` is currently implemented via serialisation, since V8 does not currently have direct support for cross-isolate sharing.\n\n\n### Other Implementations\n\nCurrently, known implementations of this API are included in\n\n* V8 natively (both C and C++)\n* Wabt (only C?)\n* Wasmtime (only C?)\n* [Wasmer](https://github.com/wasmerio/wasmer/tree/master/lib/c-api) (only C, C++ coming soon)\n\n\n### TODO\n\nPossible API tweaks:\n\n  * Add `Ref::eq` (or better, a subclass `EqRef::eq`) for reference equality?\n\n  * Add a way to return error messages from `Module::make` and `Module::validate`.\n\n  * Use `restrict` in C API?\n\n  * Find a way to perform C callbacks through C++ without extra wrapper?\n\n  * Add iterators to `vec` class?\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebassembly%2Fwasm-c-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebassembly%2Fwasm-c-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebassembly%2Fwasm-c-api/lists"}