Module: Extism::HostEnvironment::ClassMethods

Defined in:
lib/extism/host_environment.rb

Instance Method Summary collapse

Instance Method Details

#register_import(func_name, parameters, returns) ⇒ Object

Register an import by name. You must know the wasm signature of the function to do this.

Examples:

register_import :my_func, [Extism::ValType::I64], [Extism::ValType::F64]

Parameters:

  • func_name (Symbol | String)

    The name of the wasm import function. Assumes ‘env` namespace.

  • parameters (Array<Extism::ValType>)

    The Wasm types of the parameters that the import takes

  • returns (Array<Extism::ValType>)

    The Wasm types of the returns that the import returns. Will usually be just be one of these.



53
54
55
56
# File 'lib/extism/host_environment.rb', line 53

def register_import(func_name, parameters, returns)
  import_funcs = class_variable_get(:@@import_funcs)
  import_funcs << [func_name, parameters, returns]
end