Skip to content

Instantly share code, notes, and snippets.

@codefromthecrypt
Created June 2, 2023 00:05
Show Gist options
  • Save codefromthecrypt/96a42e333fb6efebae17b4bf5ce27ec2 to your computer and use it in GitHub Desktop.
Save codefromthecrypt/96a42e333fb6efebae17b4bf5ce27ec2 to your computer and use it in GitHub Desktop.
work around for weird ABI that expect the host to export memory
(module $env
;; import and re-export logstr. the exported function has the same signature
;; and passes the parameters via local.get 0..n
(import "host" "logstr" (func $logstr (param i32)))
(func (export "logstr") (param i32)
(call $logstr (local.get 0)))
(memory (export "memory") 1)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment