Skip to content

[#446 Tier 1 #5 follow-up] examples/wasm-exports-demo.affine — end-to-end usage demo #500

Description

@hyperpolymath

Context

Closed #455 shipped via PR #467 (Deno-ESM wasm_export_call + WasmValue + JS codegen). The smoke-test landed inline (tests/codegen-deno/wasm_call.{affine,harness.mjs} exercises the prior wasmCall surface and gets supplemented by the new export-call dispatch under the same harness).

A stand-alone usage demo under examples/ was deferred per the owner scope breakdown:

Example: examples/wasm-exports-demo.affine loading a tiny wasm + invoking an export end-to-end

This issue tracks that.

Scope

A copy-paste-ready, well-commented example in examples/ that:

  1. Reads a tiny .wasm module from disk (or embeds it via a base64 constant).
  2. Instantiates it via existing stdlib/Deno.affine wasmInstance (or WebAssembly.instantiate host bridge).
  3. Builds a [WasmValue] argument list using the new constructors (wv_i32 / wv_i64 / wv_f32 / wv_f64).
  4. Calls wasm_export_call(exports, "fn_name", args) and uses wv_as_int / wv_as_float / wv_kind to decode the result.
  5. Demonstrates each of the four WasmValue kinds via a multi-export module (e.g. addI32, addI64, mulF32, mulF64).

Acceptance

  • examples/wasm-exports-demo.affine lands with SPDX header + extensive top-of-file docstring.
  • Compiles via --deno-esm end-to-end.
  • Runs as a smoke-test (either added to tools/run_codegen_deno_tests.sh or as a stand-alone just demo-wasm-exports recipe).
  • Round-trips one of each WasmValue kind successfully.
  • Referenced from the bindings-roadmap.adoc Tier 1 ci: Bump actions/github-script from 7.0.1 to 8.0.0 #5 row (or its surrounding "Worked example" note) as the canonical end-to-end demo.

Refs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bindingsABI, FFI, WASM, and cross-language interop surfacestier-1AS bindings top-50 Tier 1 (idaptik blockers)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions