Top Description Inners Methods
org.graalvm.nativeimage.c.function

public @Interface CFunction

extends Annotation
Annotations
@Retention:RUNTIME
@Target:METHOD
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target, org.graalvm.nativeimage.c.CContext, org.graalvm.nativeimage.c.constant.CEnum, org.graalvm.word.WordBase

Denotes a native method that calls directly from Java to C, without following the JNI protocol. This means that there are no artificial additional parameters such as the JNI environment passed, and no marshaling or processing of arguments (such as creating handles for objects) is performed. If the method is non-static, the receiver will be ignored.

Parameter types and return types must not be Java reference types, only primitive Java types, word types and CEnum types are allowed. The representation of passed primitive values matches exactly how they are specified in the Java language, for example, int as a 32-bit signed integer or char as a 16-bit unsigned integer. boolean is specified as a single byte that corresponds to true if non-zero, and to false if zero. If a Word value is passed that points to a Java object, no guarantees are taken regarding its integrity as a pointer.

The class containing the annotated method must be annotated with CContext.

Note that this annotation must not be used for native functions that use variadic arguments (varargs) because varargs calling conventions are not supported and even a declaration with a specific non-varargs signature can be incompatible with vararg target functions on some platforms.

Since
19.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
CFunction.Transition

Describes the thread state transition performed when the C function is invoked.

Method Summary

Modifier and TypeMethod and Description
public CFunction.Transition
transition()

The Java-to-C thread transition code used when calling the function.

public String
value()

The symbol name to use to link this method.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

transitionback to summary
public CFunction.Transition transition()

The Java-to-C thread transition code used when calling the function.

Since
19.0
valueback to summary
public String value()

The symbol name to use to link this method. If no value is specified, the name of the method (without name mangling or a class name prefix) is used.

Since
19.0
org.graalvm.nativeimage.c.function back to summary

public final Enum CFunction.Transition

extends Enum<CFunction.Transition>
Class Inheritance

Describes the thread state transition performed when the C function is invoked.
Since
19.0

Field Summary

Modifier and TypeField and Description
public static final CFunction.Transition
NO_TRANSITION

No prologue and epilogue is emitted.

public static final CFunction.Transition
TO_NATIVE

The thread state is transitioned from Java to C, and the Java parts of the stack are made walkable.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CFunction.Transition
public static CFunction.Transition[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

NO_TRANSITIONback to summary
public static final CFunction.Transition NO_TRANSITION

No prologue and epilogue is emitted. The C code must not block and must not call back to Java. Also, long running C code delays safepoints (and therefore garbage collection) of other threads until the call returns.

Since
19.0
TO_NATIVEback to summary
public static final CFunction.Transition TO_NATIVE

The thread state is transitioned from Java to C, and the Java parts of the stack are made walkable. The C code can block and call back to Java.

Since
19.0

Constructor Detail

Transitionback to summary
private Transition()

Method Detail

valueOfback to summary
public static CFunction.Transition valueOf(String name)
valuesback to summary
public static CFunction.Transition[] values()