Class WasmModule

java.lang.Object
ai.tegmentum.webassembly4j.runtime.WasmModule
All Implemented Interfaces:
AutoCloseable

public final class WasmModule extends Object implements AutoCloseable
  • Method Details

    • call

      public <R> R call(String functionName, Class<R> returnType, Object... args)
      Invokes a function using a shared instance. The shared instance is created lazily on first call and reused for subsequent calls. State mutations (globals, memory) persist across calls. Use newInstance() for isolated execution.
    • callVoid

      public void callVoid(String functionName, Object... args)
      Invokes a void function using a shared instance. The shared instance is created lazily on first call and reused for subsequent calls. State mutations (globals, memory) persist across calls. Use newInstance() for isolated execution.
    • newInstance

      public WasmInstance newInstance()
      Creates a new isolated instance of this module.
    • bind

      public <T extends AutoCloseable> T bind(Class<T> iface)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable