getNativeValue: Retrieve the value of a compiled object

View source: R/struct.R

getNativeValueR Documentation

Retrieve the value of a compiled object

Description

This function allows the caller to retrieve the value of a compiled, native object by providing the address of the object and a description of its type/structure. This can be used to retrieve global variables or values that are returned by reference from other calls to compiled routines.

Usage

getNativeValue(ptr, type)

Arguments

ptr

an external pointer giving the address of the object

type

a CIF that describes the type/structure of the object being retrieved

Value

The R object converted from the native address.

Author(s)

Duncan Temple Lang

References

libffi

See Also

getStructValue getStructField

Examples

  ptr = getNativeSymbolInfo("globalStruct")$address
  myStruct.type = structType(list(s = sint16Type, i = sint32Type, d = doubleType, str = stringType))
  getNativeValue(ptr, myStruct.type)

omegahat/Rffi documentation built on Nov. 29, 2023, 12:48 a.m.