All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.glfw.GLFWAllocateCallbackI Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.3.4
Show newest version
/*
 * 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 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 {@code size} bytes long, or {@code NULL} if allocation failed. Note that not all parts of GLFW * handle allocation failures gracefully yet.

* *

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.

* *

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 * (*{@link #invoke}) (
 *     size_t size,
 *     void *user
 * )
* * @since version 3.4 */ @FunctionalInterface @NativeType("GLFWallocatefun") public interface GLFWAllocateCallbackI extends CallbackI { FFICIF CIF = apiCreateCIF( FFI_DEFAULT_ABI, ffi_type_pointer, ffi_type_pointer, ffi_type_pointer ); @Override default FFICIF getCallInterface() { return CIF; } @Override default void callback(long ret, long args) { long __result = invoke( memGetAddress(memGetAddress(args)), memGetAddress(memGetAddress(args + POINTER_SIZE)) ); apiClosureRetP(ret, __result); } /** * Will be called for memory allocation requests. * * @param size the minimum size, in bytes, of the memory block * @param user the user-defined pointer from the allocator * * @return the address of the newly allocated memory block, or {@code NULL} if an error occurred */ @NativeType("void *") long invoke(@NativeType("size_t") long size, @NativeType("void *") long user); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy