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 CField,
CFieldAddress, or CFieldOffset. All calls of the interface methods are replaced
with the appropriate memory or address arithmetic operations. Here is an example to define a
complex number structure:
file="org/graalvm/nativeimage/StackValue.java" region="ComplexValue"
CContext. Allocate an instances of the struct either by
org.graalvm.nativeimage.StackValue#get(java.lang.Class) or by
org.graalvm.nativeimage.UnmanagedMemory#malloc(org.graalvm.word.UnsignedWord) .
To access an array of structs one can define a special addressOf method:
file="org/graalvm/nativeimage/StackValue.java" region="IntOrDouble"
file="org/graalvm/nativeimage/StackValue.java" region="acceptIntIntDouble"
org.graalvm.nativeimage.StackValue , org.graalvm.nativeimage.UnmanagedMemory
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public boolean | |
| public String |
| addStructKeyword | back to summary |
|---|---|
| public boolean addStructKeyword() Add the C "struct" keyword to the name specified in
| |
| isIncomplete | back to summary |
|---|---|
| public boolean isIncomplete() If marked as incomplete, we will not try to determine the size of the struct.
| |
| value | back to summary |
|---|---|
| public String value() Specifies the name of the imported C struct type. If no name is provided, the type name is used as the struct name.
| |