Annotation Interface FFMReturn
Transforms a native function such that it returns the value of an output parameter.
Supports the following transformations:
- From
void function(..., type *paramOut, ...)totype function(...). The method will return a single value only, of the same type as the element type of the output parameter. - From
sizeT function(..., sizeT paramSize, type *paramOut, ...)toMemorySegment function(..., sizeT paramSize, ...). The method will allocate a buffer of size equal to theparamSizeparameter, which must be annotated withFFMReturn.Size. The returnedMemorySegmentwill have a size equal to the value returned by the native function. The return type can also be aString, in which case the output buffer will be decoded and returned as a string. - From
void function(..., sizeT paramSize, sizeT *length, type *paramOut, ...)toMemorySegment function(..., sizeT paramSize, ...). The method will allocate a buffer of size equal to theparamSizeparameter, which must be annotated withFFMReturn.Size. It will also allocate storage for the outputlengthparameter. The returnedMemorySegmentwill have a size equal to the value returned in thelengthparameter. The return type can also be aString, in which case the output buffer will be decoded and returned as a string.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceWhen specified, the parameter will be used as the size of the internally allocated return buffer.static @interfaceSpecifies the output parameter that receives the actual buffer size. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionintIndex of the buffer parameter that has been transformed to a return value. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhen true, the actual string size includes the null-termination character.
-
Element Details
-
value
int valueIndex of the buffer parameter that has been transformed to a return value.It should be the native parameter index, ignoring any virtual parameters before the actual parameters.
-
includesNT
boolean includesNTWhen true, the actual string size includes the null-termination character.- Default:
false
-