Interface UpcallBinder<T>


public non-sealed interface UpcallBinder<T>
The binder class for upcall interfaces.

Upcall binder implementations can be created using ffmUpcall.

  • Method Details

    • descriptor

      FunctionDescriptor descriptor()
      The upcall function descriptor.
      Returns:
      the function descriptor
    • handle

      MethodHandle handle()
      The upcall method handle.
      Returns:
      the method handle
    • stack

      @Nullable MemoryLayout stack()
      The memory layout to use when allocating storage for a struct or union returned by value.

      This method is used for integration with LWJGL 3 callbacks. It should not be used for custom bindings.

      Returns:
      the memory layout, or null if not applicable
    • allocate

      default MemorySegment allocate(Arena arena, T upcall)
      Allocates an FFM upcall stub for the specified upcall instance.
      Parameters:
      arena - the arena to use for the allocation
      upcall - the upcall instance
      Returns:
      the upcall stub
    • allocate

      default MemorySegment allocate(Arena arena, T upcall, Linker.Option... options)
      Allocates an FFM upcall stub for the specified upcall instance.
      Parameters:
      arena - the arena to use for the allocation
      upcall - the upcall instance
      options - the linker options to apply
      Returns:
      the upcall stub