Class FFM

java.lang.Object
org.lwjgl.system.ffm.FFM

  • Field Details

    • opaque

      public static final Mapping.Opaque opaque
      A mapping that can be used to typedef opaque C types.
    • jboolean

      public static final Mapping.Boolean jboolean
      The Java boolean mapping.
    • jbyte

      public static final Mapping.Byte jbyte
      The Java byte mapping.
    • jchar

      public static final Mapping.Char jchar
      The Java char mapping.
    • jshort

      public static final Mapping.Short jshort
      The Java short mapping.
    • jint

      public static final Mapping.Int jint
      The Java int mapping.
    • jlong

      public static final Mapping.Long jlong
      The Java long mapping.
    • jfloat

      public static final Mapping.Float jfloat
      The Java float mapping.
    • jdouble

      public static final Mapping.Double jdouble
      The Java double mapping.
    • int8_t

      public static final Mapping.Byte int8_t
      The C int8_t type mapping.
    • int16_t

      public static final Mapping.Short int16_t
      The C int16_t type mapping.
    • int32_t

      public static final Mapping.Int int32_t
      The C int32_t type mapping.
    • int64_t

      public static final Mapping.Long int64_t
      The C int64_t type mapping.
    • uint8_t

      public static final Mapping.Byte uint8_t
      The C uint8_t type mapping.
    • uint16_t

      public static final Mapping.Short uint16_t
      The C uint16_t type mapping.
    • uint32_t

      public static final Mapping.Int uint32_t
      The C uint32_t type mapping.
    • uint64_t

      public static final Mapping.Long uint64_t
      The C uint64_t type mapping.
    • size_t

      public static final Mapping.Size size_t
      The C size_t type mapping.
    • ptrdiff_t

      public static final Mapping.Size ptrdiff_t
      The C ssize_t type mapping.
    • intptr_t

      public static final Mapping.Size intptr_t
      The C intptr_t type mapping.
    • uintptr_t

      public static final Mapping.Size uintptr_t
      The C uintptr_t type mapping.
    • bool

      public static final Mapping.Boolean bool
      The C bool type mapping.
    • cchar

      public static final Mapping.Byte cchar
      The C char type mapping.
    • cshort

      public static final Mapping.Short cshort
      The C short type mapping.
    • cint

      public static final Mapping.Int cint
      The C int type mapping.
    • clong

      public static final Mapping.CLong clong
      The C long type mapping.
    • long_long

      public static final Mapping.Long long_long
      The C long long type mapping.
    • unsigned_char

      public static final Mapping.Byte unsigned_char
      The C unsigned char type mapping.
    • unsigned_short

      public static final Mapping.Short unsigned_short
      The C unsigned short type mapping.
    • unsigned_int

      public static final Mapping.Int unsigned_int
      The C unsigned int type mapping.
    • unsigned_long

      public static final Mapping.CLong unsigned_long
      The C unsigned long type mapping.
    • unsigned_long_long

      public static final Mapping.Long unsigned_long_long
      The C unsigned long long type mapping.
    • float32

      public static final Mapping.Float float32
      The C float type mapping.
    • float64

      public static final Mapping.Double float64
      The C double type 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

      public static <T> FFM.StructBinderBuilder<T> ffmStruct(Class<T> structInterface)
      Creates a StructBinder builder for the specified struct interface, with the default state.
      Parameters:
      structInterface - the struct interface
      Returns:
      the struct binder builder
    • ffmUnion

      public static <T> FFM.UnionBinderBuilder<T> ffmUnion(Class<T> unionInterface)
      Creates a UnionBinder builder for the specified union interface, with the default state.
      Parameters:
      unionInterface - the union interface
      Returns:
      the union binder builder
    • ffmUpcall

      public static <T> UpcallBinder<T> ffmUpcall(Class<T> upcallInterface)
      Generates a class that implements the UpcallBinder interface for the specified upcall interface, then returns a new instance of that class.
      Parameters:
      upcallInterface - the upcall interface
      Returns:
      the UpcallBinder implementation
    • ffmUpcall

      public static <T> UpcallBinder<T> ffmUpcall(Class<T> upcallInterface, @Nullable FFICIF cif)
      Generates a class that implements the UpcallBinder interface 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 interface
      cif - the libffi call interface
      Returns:
      the UpcallBinder implementation
    • ffmScopedArena

      public static ScopedValue<Arena> ffmScopedArena()
      Returns the scoped arena.

      This method is used for integration with LWJGL 3 callbacks. It should not be used for custom bindings.

    • ffmScopedRun

      public static void ffmScopedRun(Arena arena, Runnable runnable)
      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 arena
      runnable - 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 arena
      op - the operation
      Returns:
      the result of the operation
      Throws:
      X
    • ffmGenerate

      public static <T> T ffmGenerate(Class<T> bindingInterface)
      Generates a class that implements the specified binding interface, using the FFMConfig registered for this interface.
      Parameters:
      bindingInterface - the binding interface
      Returns:
      the generated binding implementation
      Throws:
      IllegalStateException - if no FFMConfig is registered for the specified interface
    • ffmGenerate

      public static <T> T ffmGenerate(Class<T> bindingInterface, FFMConfig config)
      Generates a class that implements the specified binding interface, using the specified FFMConfig.
      Parameters:
      bindingInterface - the binding interface
      config - the binding configuration
      Returns:
      the generated binding implementation
    • ffmConfigBuilder

      public static FFM.FFMConfigBuilder ffmConfigBuilder(MethodHandles.Lookup lookup)
      Creates a builder for FFMConfig instances, with the default state.
    • ffmConfig

      public static void ffmConfig(Package _package, @Nullable FFMConfig config)
      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 package
      config - the binding configuration, or null to unregister the specified package
      See Also:
    • ffmConfig

      public static void ffmConfig(Class<?> _class, @Nullable FFMConfig config)
      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 class
      config - the binding configuration, or null to unregister the specified class
      See Also: