Interface GLFWAllocateCallbackI

All Superinterfaces:
org.lwjgl.system.CallbackI, org.lwjgl.system.Pointer
All Known Implementing Classes:
GLFWAllocateCallback
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface GLFWAllocateCallbackI extends org.lwjgl.system.CallbackI
The function pointer type for memory allocation callbacks.

This is the function pointer type for memory allocation callbacks. A memory allocation callback function has the following signature:


 void* function_name(size_t size, void* user)

This function must return either a memory block at least size bytes long, or NULL if allocation failed. Note that not all parts of GLFW handle allocation failures gracefully yet.

This function may be called during Init but before the library is flagged as initialized, as well as during Terminate after the library is no longer flagged as initialized.

Any memory allocated by this function will be deallocated during library termination or earlier.

The size will always be greater than zero. Allocations of size zero are filtered out before reaching the custom allocator.

Note
  • The returned memory block must be valid at least until it is deallocated.
  • This function should not call any GLFW function.
  • This function may be called from any thread that calls GLFW functions.

Type


 void * (*invoke(long, long)) (
     size_t size,
     void *user
 )
Since:
version 3.4
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer

    org.lwjgl.system.Pointer.Default
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.lwjgl.system.libffi.FFICIF
     

    Fields inherited from interface org.lwjgl.system.Pointer

    BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    callback(long ret, long args)
     
    default org.lwjgl.system.libffi.FFICIF
     
    long
    invoke(long size, long user)
    Will be called for memory allocation requests.

    Methods inherited from interface org.lwjgl.system.CallbackI

    address
  • Field Details

    • CIF

      static final org.lwjgl.system.libffi.FFICIF CIF
  • Method Details

    • getCallInterface

      default org.lwjgl.system.libffi.FFICIF getCallInterface()
      Specified by:
      getCallInterface in interface org.lwjgl.system.CallbackI
    • callback

      default void callback(long ret, long args)
      Specified by:
      callback in interface org.lwjgl.system.CallbackI
    • invoke

      long invoke(long size, long user)
      Will be called for memory allocation requests.
      Parameters:
      size - the minimum size, in bytes, of the memory block
      user - the user-defined pointer from the allocator
      Returns:
      the address of the newly allocated memory block, or NULL if an error occurred