Package org.lwjgl.system.libffi
Class FFIClosure
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.system.libffi.FFIClosure
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
public class FFIClosure extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResourceThe libffi closure structure.Layout
struct ffi_closure {ffi_cif*cif(); void (*)(ffi_cif*,void*,void**,void*)fun(); void *user_data(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFFIClosure.BufferAn array ofFFIClosurestructs.
-
Constructor Summary
Constructors Constructor Description FFIClosure(java.nio.ByteBuffer container)Creates aFFIClosureinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FFIClosurecalloc()Returns a newFFIClosureinstance allocated withmemCalloc.static FFIClosure.Buffercalloc(int capacity)Returns a newFFIClosure.Bufferinstance allocated withmemCalloc.static FFIClosure.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newFFIClosure.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static FFIClosurecalloc(org.lwjgl.system.MemoryStack stack)Returns a newFFIClosureinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.FFICIFcif()a pointer to anffi_cifstructurestatic FFIClosurecreate()Returns a newFFIClosureinstance allocated withBufferUtils.static FFIClosure.Buffercreate(int capacity)Returns a newFFIClosure.Bufferinstance allocated withBufferUtils.static FFIClosurecreate(long address)Returns a newFFIClosureinstance for the specified memory address.static FFIClosure.Buffercreate(long address, int capacity)Create aFFIClosure.Bufferinstance at the specified memory.static FFIClosurecreateSafe(long address)static FFIClosure.BuffercreateSafe(long address, int capacity)longfun()a pointer to a functionstatic FFIClosuremalloc()Returns a newFFIClosureinstance allocated withmemAlloc.static FFIClosure.Buffermalloc(int capacity)Returns a newFFIClosure.Bufferinstance allocated withmemAlloc.static FFIClosure.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newFFIClosure.Bufferinstance allocated on the specifiedMemoryStack.static FFIClosuremalloc(org.lwjgl.system.MemoryStack stack)Returns a newFFIClosureinstance allocated on the specifiedMemoryStack.static FFICIFncif(long struct)Unsafe version ofcif().static longnfun(long struct)Unsafe version offun().static longnuser_data(long struct)Unsafe version ofuser_data().intsizeof()longuser_data()a pointer to user-specified data
-
-
-
Constructor Detail
-
FFIClosure
public FFIClosure(java.nio.ByteBuffer container)
Creates aFFIClosureinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
cif
public FFICIF cif()
a pointer to anffi_cifstructure
-
fun
public long fun()
a pointer to a function
-
user_data
public long user_data()
a pointer to user-specified data
-
malloc
public static FFIClosure malloc()
Returns a newFFIClosureinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static FFIClosure calloc()
Returns a newFFIClosureinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static FFIClosure create()
Returns a newFFIClosureinstance allocated withBufferUtils.
-
create
public static FFIClosure create(long address)
Returns a newFFIClosureinstance for the specified memory address.
-
createSafe
@Nullable public static FFIClosure createSafe(long address)
-
malloc
public static FFIClosure.Buffer malloc(int capacity)
Returns a newFFIClosure.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static FFIClosure.Buffer calloc(int capacity)
Returns a newFFIClosure.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static FFIClosure.Buffer create(int capacity)
Returns a newFFIClosure.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static FFIClosure.Buffer create(long address, int capacity)
Create aFFIClosure.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
@Nullable public static FFIClosure.Buffer createSafe(long address, int capacity)
-
malloc
public static FFIClosure malloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosureinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
public static FFIClosure calloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosureinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
public static FFIClosure.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
calloc
public static FFIClosure.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
nfun
public static long nfun(long struct)
Unsafe version offun().
-
nuser_data
public static long nuser_data(long struct)
Unsafe version ofuser_data().
-
-