Class FFM
Global configuration options:
Configuration.FFM_DEFAULT_NULLABLE_ANNOTATIONConfiguration.FFM_UPCALL_ARENAConfiguration.FFM_UPCALL_EXCEPTION_CATCHConfiguration.FFM_UPCALL_EXCEPTION_HANDLER
Configuration methods:
Bootstrapping methods:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder class forFFMConfig.static classFFM.GroupBinderBuilder<T, L extends GroupLayout, M extends GroupBinder<L,T>, SELF extends FFM.GroupBinderBuilder<T, L, M, SELF>> Base class for struct/union binder builders.static final classA builder forStructBinderinstances.static final classA builder forUnionBinderinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ValueLayout.OfByteA layout that can be used to map the Cchartype.static final ValueLayout.OfIntA layout that can be used to map the Cinttype.static final ValueLayoutA layout that can be used to map the Clongtype.static final ValueLayout.OfShortA layout that can be used to map the Cshorttype.static final ValueLayout.OfFloatA layout that can be used to map the Cfloattype.static final ValueLayout.OfDoubleA layout that can be used to map the Cdoubletype.static final ValueLayout.OfShortA layout that can be used to map the Cint16_ttype.static final ValueLayout.OfIntA layout that can be used to map the Cint32_ttype.static final ValueLayout.OfLongA layout that can be used to map the Cint64_ttype.static final ValueLayout.OfByteA layout that can be used to map the Cint8_ttype.static final AddressLayoutA layout that can be used to map the Cintptr_ttype.static final ValueLayout.OfLongA layout that can be used to map the Clong longtype.static final AddressLayoutA layout that can be used to map the Cssize_ttype.static final AddressLayoutA layout that can be used to map the Csize_ttype.static final ValueLayout.OfShortA layout that can be used to map the Cuint16_ttype.static final ValueLayout.OfIntA layout that can be used to map the Cuint32_ttype.static final ValueLayout.OfLongA layout that can be used to map the Cuint64_ttype.static final ValueLayout.OfByteA layout that can be used to map the Cuint8_ttype.static final AddressLayoutA layout that can be used to map the Cuintptr_ttype.static final ValueLayout.OfByteA layout that can be used to map the Cunsigned chartype.static final ValueLayoutA layout that can be used to map the Cunsigned longtype.static final ValueLayout.OfIntA layout that can be used to map the Cunsigned inttype.static final ValueLayout.OfLongA layout that can be used to map the Cunsigned long longtype.static final ValueLayout.OfShortA layout that can be used to map the Cunsigned shorttype. -
Method Summary
Modifier and TypeMethodDescriptionstatic SequenceLayoutarray(MemoryLayout layout, long elementCount) Creates aSequenceLayoutwith the specified named layout and element count.static MethodHandlebootstrapDowncall(MethodHandles.Lookup lookup, String name, Class<?> bootstrapClass, int methodIndex) The Condy boostrap method for downcalls, called the first time the LDC bytecode is executed.static voidRegisters a binding configuration for the specified class.static voidRegisters a binding configuration for the specified package.static FFM.FFMConfigBuilderffmConfigBuilder(MethodHandles.Lookup lookup) Creates a builder forFFMConfiginstances, with the default state.static <T> TffmGenerate(Class<T> bindingInterface) Generates a class that implements the specified binding interface, using theFFMConfigregistered for this interface.static <T> TffmGenerate(Class<T> bindingInterface, FFMConfig config) Generates a class that implements the specified binding interface, using the specifiedFFMConfig.static ScopedValue<Arena> Returns the scoped arena.static <R, X extends Throwable>
RffmScopedCall(Arena arena, ScopedValue.CallableOp<? extends R, X> op) Runs the specified operation within the scope of the specified arena.static voidffmScopedRun(Arena arena, Runnable runnable) Runs the specified runnable within the scope of the specified arena.static <T> FFM.StructBinderBuilder<T> Creates aStructBinderbuilder for the specified struct interface, with the default state.static <T> FFM.UnionBinderBuilder<T> Creates aUnionBinderbuilder for the specified union interface, with the default state.static <T> UpcallBinder<T> Generates a class that implements theUpcallBinderinterface for the specified upcall interface, then returns a new instance of that class.static <T> UpcallBinder<T> Generates a class that implements theUpcallBinderinterface for the specified upcall interface and associated libffi call interface, then returns a new instance of that class.static AddressLayoutCreates an opaque pointer layout with the specified name.static AddressLayoutp(MemoryLayout layout) Creates a pointer layout that targets the specified layout.static AddressLayoutp(GroupBinder<?, ?> binder) Creates a pointer layout that targets the specified binder's layout.static AddressLayouttypedef(String name, AddressLayout layout) Creates an alias of the specified layout with a new name.static SequenceLayouttypedef(String name, SequenceLayout layout) Creates an alias of the specified layout with a new name.static StructLayouttypedef(String name, StructLayout layout) Creates an alias of the specified layout with a new name.static UnionLayouttypedef(String name, UnionLayout layout) Creates an alias of the specified layout with a new name.static ValueLayouttypedef(String name, ValueLayout layout) Creates an alias of the specified layout with a new name.static ValueLayout.OfBytetypedef(String name, ValueLayout.OfByte layout) Creates an alias of the specified layout with a new name.static ValueLayout.OfDoubletypedef(String name, ValueLayout.OfDouble layout) Creates an alias of the specified layout with a new name.static ValueLayout.OfFloattypedef(String name, ValueLayout.OfFloat layout) Creates an alias of the specified layout with a new name.static ValueLayout.OfInttypedef(String name, ValueLayout.OfInt layout) Creates an alias of the specified layout with a new name.static ValueLayout.OfLongtypedef(String name, ValueLayout.OfLong layout) Creates an alias of the specified layout with a new name.static ValueLayout.OfShorttypedef(String name, ValueLayout.OfShort layout) Creates an alias of the specified layout with a new name.
-
Field Details
-
int8_t
A layout that can be used to map the Cint8_ttype. -
int16_t
A layout that can be used to map the Cint16_ttype. -
int32_t
A layout that can be used to map the Cint32_ttype. -
int64_t
A layout that can be used to map the Cint64_ttype. -
uint8_t
A layout that can be used to map the Cuint8_ttype. -
uint16_t
A layout that can be used to map the Cuint16_ttype. -
uint32_t
A layout that can be used to map the Cuint32_ttype. -
uint64_t
A layout that can be used to map the Cuint64_ttype. -
size_t
A layout that can be used to map the Csize_ttype. -
ptrdiff_t
A layout that can be used to map the Cssize_ttype. -
intptr_t
A layout that can be used to map the Cintptr_ttype. -
uintptr_t
A layout that can be used to map the Cuintptr_ttype. -
cchar
A layout that can be used to map the Cchartype. -
cshort
A layout that can be used to map the Cshorttype. -
cint
A layout that can be used to map the Cinttype. -
clong
A layout that can be used to map the Clongtype. -
long_long
A layout that can be used to map the Clong longtype. -
unsigned_char
A layout that can be used to map the Cunsigned chartype. -
unsigned_short
A layout that can be used to map the Cunsigned shorttype. -
unsigned_int
A layout that can be used to map the Cunsigned inttype. -
unsigned_clong
A layout that can be used to map the Cunsigned longtype. -
unsigned_long_long
A layout that can be used to map the Cunsigned long longtype. -
float32
A layout that can be used to map the Cfloattype. -
float64
A layout that can be used to map the Cdoubletype.
-
-
Method Details
-
bootstrapDowncall
public static MethodHandle bootstrapDowncall(MethodHandles.Lookup lookup, String name, Class<?> bootstrapClass, int methodIndex) throws IllegalAccessException The Condy boostrap method for downcalls, called the first time the LDC bytecode is executed. [INTERNAL API]- Throws:
IllegalAccessException
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
typedef
Creates an alias of the specified layout with a new name.- Parameters:
name- the new namelayout- the layout to alias- Returns:
- the new layout
-
array
Creates aSequenceLayoutwith the specified named layout and element count.- Parameters:
layout- the element layout, which must be namedelementCount- the number of elements- Returns:
- the sequence layout
-
opaque
Creates an opaque pointer layout with the specified name.- Parameters:
name- the opaque pointer name- Returns:
- the opaque pointer layout
-
p
Creates a pointer layout that targets the specified binder's layout.- Parameters:
binder- the binder that provides the target layout- Returns:
- the pointer layout
-
p
Creates a pointer layout that targets the specified layout.- Parameters:
layout- the target layout- Returns:
- the pointer layout
-
ffmStruct
Creates aStructBinderbuilder for the specified struct interface, with the default state.- Parameters:
structInterface- the struct interface- Returns:
- the struct binder builder
-
ffmUnion
Creates aUnionBinderbuilder for the specified union interface, with the default state.- Parameters:
unionInterface- the union interface- Returns:
- the union binder builder
-
ffmUpcall
Generates a class that implements theUpcallBinderinterface for the specified upcall interface, then returns a new instance of that class.- Parameters:
upcallInterface- the upcall interface- Returns:
- the
UpcallBinderimplementation
-
ffmUpcall
Generates a class that implements theUpcallBinderinterface for the specified upcall interface and associated libffi call interface, then returns a new instance of that class.This method is used for integration with LWJGL 3 callbacks. It should not be used for custom bindings.
- Parameters:
upcallInterface- the upcall interfacecif- the libffi call interface- Returns:
- the
UpcallBinderimplementation
-
ffmScopedArena
Returns the scoped arena.This method is used for integration with LWJGL 3 callbacks. It should not be used for custom bindings.
-
ffmScopedRun
Runs the specified runnable within the scope of the specified arena. If the bindings generator needs to allocate memory before this method returns, it will use this arena.This method is used for integration with LWJGL 3 callbacks. It should not be used for custom bindings.
- Parameters:
arena- the arenarunnable- the runnable
-
ffmScopedCall
public static <R, X extends Throwable> R ffmScopedCall(Arena arena, ScopedValue.CallableOp<? extends R, X> op) throws X Runs the specified operation within the scope of the specified arena. If the bindings generator needs to allocate memory before this method returns, it will use this arena.This method is used for integration with LWJGL 3 callbacks. It should not be used for custom bindings.
- Parameters:
arena- the arenaop- the operation- Returns:
- the result of the operation
- Throws:
X
-
ffmGenerate
Generates a class that implements the specified binding interface, using theFFMConfigregistered for this interface.- Parameters:
bindingInterface- the binding interface- Returns:
- the generated binding implementation
- Throws:
IllegalStateException- if noFFMConfigis registered for the specified interface
-
ffmGenerate
Generates a class that implements the specified binding interface, using the specifiedFFMConfig.- Parameters:
bindingInterface- the binding interfaceconfig- the binding configuration- Returns:
- the generated binding implementation
-
ffmConfigBuilder
Creates a builder forFFMConfiginstances, with the default state. -
ffmConfig
Registers a binding configuration for the specified package.The specified configuration will be used when generating any interface that belongs to this package, for which a more specific configuration does not exist.
- Parameters:
_package- the packageconfig- the binding configuration, or null to unregister the specified package- See Also:
-
ffmConfig
Registers a binding configuration for the specified class.The specified configuration will be used when generating any interface that is this class or is enclosed by it, for which a more specific configuration does not exist.
- Parameters:
_class- the classconfig- the binding configuration, or null to unregister the specified class- See Also:
-