Interface ClassFinalizeFunc

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 ClassFinalizeFunc extends FunctionPointer

Functional interface declaration of the ClassFinalizeFunc callback.

See Also:
  • Method Details

    • run

      void run(TypeClass gClass, @Nullable MemorySegment classData)

      A callback function used by the type system to finalize a class.

      This function is rarely needed, as dynamically allocated class resources should be handled by GBaseInitFunc() and GBaseFinalizeFunc().

      Also, specification of a GClassFinalizeFunc() in the GTypeInfo structure of a static type is invalid, because classes of static types will never be finalized (they are artificially kept alive when their reference count drops to zero).

      Parameters:
      gClass - The GTypeClass structure to finalize
      classData - The classData member supplied via the GTypeInfo structure
    • upcall

      default void upcall(MemorySegment gClass, MemorySegment classData)
      The upcall method is called from native code. The parameters are marshaled and run(TypeClass, MemorySegment) is executed.
    • toCallback

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