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 Mapping.BooleanThe Cbooltype mapping.static final Mapping.ByteThe Cchartype mapping.static final Mapping.IntThe Cinttype mapping.static final Mapping.CLongThe Clongtype mapping.static final Mapping.ShortThe Cshorttype mapping.static final Mapping.FloatThe Cfloattype mapping.static final Mapping.DoubleThe Cdoubletype mapping.static final Mapping.ShortThe Cint16_ttype mapping.static final Mapping.IntThe Cint32_ttype mapping.static final Mapping.LongThe Cint64_ttype mapping.static final Mapping.ByteThe Cint8_ttype mapping.static final Mapping.SizeThe Cintptr_ttype mapping.static final Mapping.BooleanThe Javabooleanmapping.static final Mapping.ByteThe Javabytemapping.static final Mapping.CharThe Javacharmapping.static final Mapping.DoubleThe Javadoublemapping.static final Mapping.FloatThe Javafloatmapping.static final Mapping.IntThe Javaintmapping.static final Mapping.LongThe Javalongmapping.static final Mapping.ShortThe Javashortmapping.static final Mapping.LongThe Clong longtype mapping.static final Mapping.OpaqueA mapping that can be used to typedef opaque C types.static final Mapping.SizeThe Cssize_ttype mapping.static final Mapping.SizeThe Csize_ttype mapping.static final Mapping.ShortThe Cuint16_ttype mapping.static final Mapping.IntThe Cuint32_ttype mapping.static final Mapping.LongThe Cuint64_ttype mapping.static final Mapping.ByteThe Cuint8_ttype mapping.static final Mapping.SizeThe Cuintptr_ttype mapping.static final Mapping.ByteThe Cunsigned chartype mapping.static final Mapping.IntThe Cunsigned inttype mapping.static final Mapping.CLongThe Cunsigned longtype mapping.static final Mapping.LongThe Cunsigned long longtype mapping.static final Mapping.ShortThe Cunsigned shorttype mapping. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Field Details
-
opaque
A mapping that can be used to typedef opaque C types. -
jboolean
The Javabooleanmapping. -
jbyte
The Javabytemapping. -
jchar
The Javacharmapping. -
jshort
The Javashortmapping. -
jint
The Javaintmapping. -
jlong
The Javalongmapping. -
jfloat
The Javafloatmapping. -
jdouble
The Javadoublemapping. -
int8_t
The Cint8_ttype mapping. -
int16_t
The Cint16_ttype mapping. -
int32_t
The Cint32_ttype mapping. -
int64_t
The Cint64_ttype mapping. -
uint8_t
The Cuint8_ttype mapping. -
uint16_t
The Cuint16_ttype mapping. -
uint32_t
The Cuint32_ttype mapping. -
uint64_t
The Cuint64_ttype mapping. -
size_t
The Csize_ttype mapping. -
ptrdiff_t
The Cssize_ttype mapping. -
intptr_t
The Cintptr_ttype mapping. -
uintptr_t
The Cuintptr_ttype mapping. -
bool
The Cbooltype mapping. -
cchar
The Cchartype mapping. -
cshort
The Cshorttype mapping. -
cint
The Cinttype mapping. -
clong
The Clongtype mapping. -
long_long
The Clong longtype mapping. -
unsigned_char
The Cunsigned chartype mapping. -
unsigned_short
The Cunsigned shorttype mapping. -
unsigned_int
The Cunsigned inttype mapping. -
unsigned_long
The Cunsigned longtype mapping. -
unsigned_long_long
The Cunsigned long longtype mapping. -
float32
The Cfloattype mapping. -
float64
The Cdoubletype mapping.
-
-
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
-
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:
-