Skip to content

Typed Function References

Typed function references make function refs carry specific types and enable call_ref.

(module
(type $t0 (func (param i32) (result i32)))
(func $inc (type $t0) (param $x i32) (result i32)
(i32.add (local.get $x) (i32.const 1)))
(table 1 funcref)
(elem (i32.const 0) $inc)
(func (export "dispatch") (param $x i32) (result i32)
(call_ref (type $t0) (local.get $x) (ref.func $inc)))
)