NAME

Wasm::Func - Interface to Web Assembly Memory

VERSION

version 0.10

SYNOPSIS

Call Wasm from Perl:

use Wasm
  -api => 0,
  -wat => q{
    (module
      (func (export "add") (param i32 i32) (result i32)
       local.get 0
       local.get 1
       i32.add)
    )
  }
;

print add(1,2), "\n";  # 3

Call Perl from Wasm:

sub hello {
  print "hello world!\n";
}

use Wasm
  -api => 0,
  -wat => q{
    (module
      (func $hello (import "main" "hello"))
      (func (export "run") (call $hello))
    )
  }
;

run();   # hello world!

DESCRIPTION

This documents the interface to functions for Wasm. Each function exported from WebAssembly is automatically imported into Perl space as a Perl subroutine. Wasm modules can import Perl subroutines using their standard import process.

SEE ALSO

Wasm

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.