Skip to content

Instantly share code, notes, and snippets.

@jeroen
Created September 15, 2019 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroen/13dde3c3f6fa1e8fde330df4135d548d to your computer and use it in GitHub Desktop.
Save jeroen/13dde3c3f6fa1e8fde330df4135d548d to your computer and use it in GitHub Desktop.
wasm in R
library(V8)
ctx <- v8()
ctx$eval("
let bytes = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01,
0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07,
0x07, 0x01, 0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01,
0x07, 0x00, 0x20, 0x00, 0x20, 0x01, 0x6a, 0x0b
]);
let module = new WebAssembly.Module(bytes);
let instance = new WebAssembly.Instance(module);
instance.exports.add(3, 4);
")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment