#[no_mangle]
pub unsafe extern "C" fn extism_function_new(
    name: *const c_char,
    inputs: *const ValType,
    n_inputs: Size,
    outputs: *const ValType,
    n_outputs: Size,
    func: ExtismFunctionType,
    user_data: *mut c_void,
    free_user_data: Option<extern "C" fn(_: *mut c_void)>
) -> *mut ExtismFunction
Expand description

Create a new host function

Arguments

  • name: function name, this should be valid UTF-8
  • inputs: argument types
  • n_inputs: number of argument types
  • outputs: return types
  • n_outputs: number of return types
  • func: the function to call
  • user_data: a pointer that will be passed to the function when it’s called this value should live as long as the function exists
  • free_user_data: a callback to release the user_data value when the resulting ExtismFunction is freed.

Returns a new ExtismFunction or null if the name argument is invalid.