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 -> (Current_plugin.t -> Val_array.t -> Val_array.t -> 'a -> unit) -> t

Create a new function, Function.v name ~params ~results ~user_data f creates a new Function 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

val free : t -> unit

Free a function

val free_all : t list -> unit

Free a list of functions

OCaml

Innovation. Community. Security.