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.NativeResource
The 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 class
FFIClosure.Buffer
An array ofFFIClosure
structs.
-
Constructor Summary
Constructors Constructor Description FFIClosure(java.nio.ByteBuffer container)
Creates aFFIClosure
instance at the current position of the specifiedByteBuffer
container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FFIClosure
calloc()
Returns a newFFIClosure
instance allocated withmemCalloc
.static FFIClosure.Buffer
calloc(int capacity)
Returns a newFFIClosure.Buffer
instance allocated withmemCalloc
.static FFIClosure.Buffer
calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static FFIClosure
calloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.FFICIF
cif()
a pointer to anffi_cif
structurestatic FFIClosure
create()
Returns a newFFIClosure
instance allocated withBufferUtils
.static FFIClosure.Buffer
create(int capacity)
Returns a newFFIClosure.Buffer
instance allocated withBufferUtils
.static FFIClosure
create(long address)
Returns a newFFIClosure
instance for the specified memory address.static FFIClosure.Buffer
create(long address, int capacity)
Create aFFIClosure.Buffer
instance at the specified memory.static FFIClosure
createSafe(long address)
static FFIClosure.Buffer
createSafe(long address, int capacity)
long
fun()
a pointer to a functionstatic FFIClosure
malloc()
Returns a newFFIClosure
instance allocated withmemAlloc
.static FFIClosure.Buffer
malloc(int capacity)
Returns a newFFIClosure.Buffer
instance allocated withmemAlloc
.static FFIClosure.Buffer
malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure.Buffer
instance allocated on the specifiedMemoryStack
.static FFIClosure
malloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure
instance allocated on the specifiedMemoryStack
.static FFICIF
ncif(long struct)
Unsafe version ofcif()
.static long
nfun(long struct)
Unsafe version offun()
.static long
nuser_data(long struct)
Unsafe version ofuser_data()
.int
sizeof()
long
user_data()
a pointer to user-specified data
-
-
-
Constructor Detail
-
FFIClosure
public FFIClosure(java.nio.ByteBuffer container)
Creates aFFIClosure
instance at the current position of the specifiedByteBuffer
container. 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:
sizeof
in classorg.lwjgl.system.Struct
-
cif
public FFICIF cif()
a pointer to anffi_cif
structure
-
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 newFFIClosure
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static FFIClosure calloc()
Returns a newFFIClosure
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static FFIClosure create()
Returns a newFFIClosure
instance allocated withBufferUtils
.
-
create
public static FFIClosure create(long address)
Returns a newFFIClosure
instance for the specified memory address.
-
createSafe
@Nullable public static FFIClosure createSafe(long address)
-
malloc
public static FFIClosure.Buffer malloc(int capacity)
Returns a newFFIClosure.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static FFIClosure.Buffer calloc(int capacity)
Returns a newFFIClosure.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static FFIClosure.Buffer create(int capacity)
Returns a newFFIClosure.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static FFIClosure.Buffer create(long address, int capacity)
Create aFFIClosure.Buffer
instance 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 newFFIClosure
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
calloc
public static FFIClosure calloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIClosure
instance allocated on the specifiedMemoryStack
and 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.Buffer
instance 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.Buffer
instance allocated on the specifiedMemoryStack
and 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()
.
-
-