Annotation Interface RawStructure

@Retention(RUNTIME) @Target(TYPE) public @interface RawStructure
Denotes Java interface that represents C memory, but without a C struct definition. The interface must extend PointerBase, i.e., it is a word type. There is never a Java class that implements the interface.

Field accesses are done via interface methods that are annotated with RawField. All calls of the interface methods are replaced with the appropriate memory operations.

The layout and size of the structure is inferred from the fields defined with RawField. All fields are aligned according to the field size, i.e., 8-byte types are aligned at 8-byte boundaries. It is currently not possible to influence the layout of fields. However, it is possible to reserve extra space at the end of the structure by specifying a sizeProvider().

To access an array of structs one can define a special addressOf method (see CStruct for more details).

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Class of a function that computes the size of the structure.
  • Element Details

    • sizeProvider

      Class<? extends IntUnaryOperator> sizeProvider
      Class of a function that computes the size of the structure. The input argument of the function is the size computed based on the layout of the fields of the structure. The returned value must not be smaller than that provided argument.

      By default, the size computed based on the layout is used.

      The provided class must have a no-argument constructor.