org.lwjgl.system.FunctionProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.lwjgl.lwjgl Show documentation
Show all versions of org.lwjgl.lwjgl Show documentation
LWJGL OSGi bundle (Core LWJGL bundle)
The newest version!
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
package org.lwjgl.system;
import java.nio.*;
import static org.lwjgl.system.MemoryStack.*;
/** A provider of native function addresses. */
@FunctionalInterface
public interface FunctionProvider {
/** {@link CharSequence} version of {@link #getFunctionAddress(ByteBuffer)}. */
default long getFunctionAddress(CharSequence functionName) {
try (MemoryStack stack = stackPush()) {
return getFunctionAddress(stack.ASCII(functionName));
}
}
/**
* Returns the function address of the specified function. If the function is not supported, returns 0L.
*
* @param functionName the encoded name of the function to query
*
* @return the function address or 0L if the function is not supported
*/
long getFunctionAddress(ByteBuffer functionName);
}