public final class CGlobalDataFactory extends Object
All method of this class can only be used at native image build time, and not at run time. It is not possible to extend the data section of an executable or define new symbols in an executable at run time.
Modifier and Type | Method and Description |
---|---|
static <T extends org.graalvm.word.PointerBase> |
createBytes(IntSupplier sizeSupplier)
Create a chunk of zero-initialized bytes with at least the length that is provided by the
specified supplier.
|
static <T extends org.graalvm.word.PointerBase> |
createBytes(IntSupplier sizeSupplier,
String symbolName)
Same as
CGlobalDataFactory.createBytes(IntSupplier) , and additionally creates a symbol with the
provided name for the allocated bytes. |
static <T extends org.graalvm.word.PointerBase> |
createBytes(Supplier<byte[]> contentSupplier)
Create a chunk of bytes that is dimensioned and initialized to contain the bytes provided by
the specified supplier.
|
static <T extends org.graalvm.word.PointerBase> |
createBytes(Supplier<byte[]> contentSupplier,
String symbolName)
Same as
CGlobalDataFactory.createBytes(Supplier) , and additionally creates a symbol with the provided
name for the allocated bytes. |
static <T extends org.graalvm.word.PointerBase> |
createCString(String content)
Create a chunk of data that is dimensioned and initialized to contain the provided string's
contents as zero-terminated modified UTF-8.
|
static <T extends org.graalvm.word.PointerBase> |
createCString(String content,
String symbolName)
Same as
CGlobalDataFactory.createCString(String) , and additionally creates a symbol with the provided
name for the allocated string. |
static <T extends org.graalvm.word.PointerBase> |
createWord()
Create a single word that is initialized to zero.
|
static <T extends org.graalvm.word.PointerBase> |
createWord(String symbolName)
Same as
CGlobalDataFactory.createWord() , and additionally creates a symbol with the provided name for
the allocated word. |
static <T extends org.graalvm.word.PointerBase> |
createWord(org.graalvm.word.WordBase initialValue)
Create a single word that is initialized to the specified value.
|
static <T extends org.graalvm.word.PointerBase> |
createWord(org.graalvm.word.WordBase initialValue,
String symbolName)
Same as
CGlobalDataFactory.createWord(WordBase) , and additionally creates a symbol with the provided
name for the allocated word. |
static <T extends org.graalvm.word.PointerBase> |
forSymbol(String symbolName)
Create a reference to the symbol with the specified name.
|
static <T extends org.graalvm.word.PointerBase> |
forSymbol(String symbolName,
boolean nonConstant)
Create a reference to the symbol with the specified name.
|
public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> forSymbol(String symbolName)
CGlobalData.get()
on the returned object at runtime returns the referenced symbol's address.public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> forSymbol(String symbolName, boolean nonConstant)
CGlobalData.get()
on the returned object at runtime returns the referenced symbol's address.nonConstant
- the provided object does not have to be used as a compile-time constant
(for example, it can be retrieved from a map), but it will always introduce a
linking dependency on that symbol in the image.public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createCString(String content)
public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createCString(String content, String symbolName)
CGlobalDataFactory.createCString(String)
, and additionally creates a symbol with the provided
name for the allocated string.public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createBytes(IntSupplier sizeSupplier)
public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createBytes(IntSupplier sizeSupplier, String symbolName)
CGlobalDataFactory.createBytes(IntSupplier)
, and additionally creates a symbol with the
provided name for the allocated bytes.public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createBytes(Supplier<byte[]> contentSupplier)
public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createBytes(Supplier<byte[]> contentSupplier, String symbolName)
CGlobalDataFactory.createBytes(Supplier)
, and additionally creates a symbol with the provided
name for the allocated bytes.public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createWord(org.graalvm.word.WordBase initialValue)
public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createWord(org.graalvm.word.WordBase initialValue, String symbolName)
CGlobalDataFactory.createWord(WordBase)
, and additionally creates a symbol with the provided
name for the allocated word.public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createWord()
public static <T extends org.graalvm.word.PointerBase> CGlobalData<T> createWord(String symbolName)
CGlobalDataFactory.createWord()
, and additionally creates a symbol with the provided name for
the allocated word.