Interface ReallocFunc

All Superinterfaces:
FunctionPointer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @Generated("org.javagi.JavaGI") public interface ReallocFunc extends FunctionPointer

Functional interface declaration of the ReallocFunc callback.

See Also:
  • Method Details

    • run

      MemorySegment run(@Nullable MemorySegment data, long size)

      Changes the size of the memory block pointed to by data to size bytes.

      The function should have the same semantics as realloc().

      Parameters:
      data - memory block to reallocate
      size - size to reallocate data to
      Returns:
      a pointer to the reallocated memory
    • upcall

      default MemorySegment upcall(MemorySegment data, long size)
      The upcall method is called from native code. The parameters are marshaled and run(MemorySegment, long) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, long) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer