org.lwjgl.glfw.GLFWDeallocateCallbackI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-glfw Show documentation
Show all versions of lwjgl-glfw Show documentation
A multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.glfw;
import org.lwjgl.system.*;
import org.lwjgl.system.libffi.*;
import static org.lwjgl.system.APIUtil.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.libffi.LibFFI.*;
/**
* The function pointer type for memory deallocation callbacks.
*
* This is the function pointer type for memory deallocation callbacks. A memory deallocation callback function has the following signature:
*
*
* void function_name(void* block, void* user)
*
* This function may deallocate the specified memory block. This memory block will have been allocated with the same allocator.
*
* This function may be called during {@link GLFW#glfwInit Init} but before the library is flagged as initialized, as well as during {@link GLFW#glfwTerminate Terminate} after the library is no
* longer flagged as initialized.
*
* The block address will never be {@code NULL}. Deallocations of {@code NULL} are filtered out before reaching the custom allocator.
*
* Note
*
*
* - The specified memory block will not be accessed by GLFW after this function is called.
* - This function should not call any GLFW function.
* - This function may be called from any thread that calls GLFW functions.
*
*
* Type
*
*
* void (*{@link #invoke}) (
* void *block,
* void *user
* )
*
* @since version 3.4
*/
@FunctionalInterface
@NativeType("GLFWdeallocatefun")
public interface GLFWDeallocateCallbackI extends CallbackI {
FFICIF CIF = apiCreateCIF(
FFI_DEFAULT_ABI,
ffi_type_void,
ffi_type_pointer, ffi_type_pointer
);
@Override
default FFICIF getCallInterface() { return CIF; }
@Override
default void callback(long ret, long args) {
invoke(
memGetAddress(memGetAddress(args)),
memGetAddress(memGetAddress(args + POINTER_SIZE))
);
}
/**
* Will be called for memory deallocation requests.
*
* @param block the address of the memory block to deallocate
* @param user the user-defined pointer from the allocator
*/
void invoke(@NativeType("void *") long block, @NativeType("void *") long user);
}