package extism

  1. Overview
  2. Docs

Function is used to create new a new function, which can be called from a WebAssembly plugin

type t

Function type

val create : string -> ?namespace:string -> params:Val_type.t list -> results:Val_type.t list -> user_data:'a -> (Host_function.t -> 'a -> unit) -> t

Create a new function, Function.v name ~params ~results ~user_data f creates a new Function.t with the given name, params specifies the argument types, results specifies the return types, user_data is used to pass arbitrary OCaml values into the function and f is the OCaml function that will be called.

val with_namespace : t -> string -> t

Update a function's namespace