Package org.lwjgl.system.ffm.mapping
@NullMarked
package org.lwjgl.system.ffm.mapping
Contains mappings between native types and
MemoryLayout instances.
Most mappings are simple wrappers over FFM layouts, but they expose a richer DSL for defining custom struct/union layouts, which enables:
- A cleaner API that doesn't pollute the static FFM API with utility methods.
- Consistently named layouts.
- Better handling of opaque types & pointer types. Opaque mappings cannot be used directly (they need to be wrapped in pointer mappings) and pointer mappings cannot be created without a target mapping.
- Enrichment of integer layouts with signedness.
- Abstraction of C long types.
Users will rarely need to create mappings from scratch. It is recommended to import static the FFM class and use the
base types that are defined there to typedef any custom types necessary.
-
ClassDescriptionDataMapping<L extends MemoryLayout>Mapping to a non-opaque layout.GroupMapping<L extends GroupLayout>A mapping for a group layout.IntegerMapping<L extends ValueLayout>A mapping for an integer layout.Mapping<L extends MemoryLayout>Mapping from
ValueLayout.JAVA_BOOLEANto Cbool.Mapping fromValueLayout.JAVA_CHARto Cuint16_t.Mapping fromValueLayout.JAVA_DOUBLEto Cdouble.Mapping fromValueLayout.JAVA_FLOATto Cfloat.Mapping fromValueLayout.ADDRESSto a C pointer.Mapping fromSequenceLayoutto a C array.Mapping fromValueLayout.ADDRESSto an integer ofsizeof(size_t)bytes.Mapping fromStructLayoutto a C struct.Mapping fromUnionLayoutto a C union.PrimitiveMapping<L extends ValueLayout>A mapping for a primitive layout.