Wasmex v0.2.0 Wasmex

Wasmex is an Elixir library for executing WebAssembly binaries.

WASM functions can be executed like this:

{:ok, bytes } = File.read("wasmex_test.wasm")
{:ok, instance } = Wasmex.start_link.from_bytes(bytes)

{:ok, [42]} == Wasmex.call_function(instance, "sum", [50, -8])

Memory can be read/written using Wasmex.Memory:

offset = 7
index = 4
value = 42

{:ok, memory} = Wasmex.Instance.memory(instance, :uint8, offset)
Wasmex.Memory.set(memory, index, value)
IO.puts Wasmex.Memory.get(memory, index) # 42

Link to this section Summary

Link to this section Functions

Link to this function

call_function(pid, name, params)

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

function_exists(pid, name)

Link to this function

memory(pid, size, offset)

Link to this function

start_link(bytes)