callCIF | R Documentation |
This function takes a CIF to invoke a compiled routine with a given signature and applies it to invoke a specific routine with that signature. The R inputs are converted to the appropriate types and the result returned as an R object.
callCIF(cif, sym, ...,
returnInputs = is(cif, "CIFWithMutableInputs") || any(cif@pointerParameters),
.args = list(...))
cif |
the previously prepared template CIF for the given signature |
sym |
an identifier for the compiled routine to be called. This
can be a string giving the name or, preferably, an object returned
from a call to |
... |
zero or more R objects that are passed as the inputs to the compiled routine, having been converted to the appropriate native types. |
returnInputs |
a logical value that indicates whether the function should return just the value returned by the compiled routine or also any inputs that may have been modified by the routine, i.e. parameters that are pointers. |
.args |
the list of the individual arguments in the call to the routine. This can be a convenient way to pass them when they are already grouped into a single object rather than being specificied individually in the call via the .... |
The invocation checks that the number of arguments matches the number expected by the CIF. It also performs the conversion as necessary.
The function returns the value from the compiled routine, having converted to an appropriate R type.
Duncan Temple Lang
CIF
void = CIF(voidType)
callCIF(void, "voidCall")
cif = CIF(doubleType, list(sint32Type, doubleType))
callCIF(cif, "foo", -1L, pi)
# use this CIF in another call.
callCIF(cif, "foo", 10L, pi)
# and call a different routine with the same signature
callCIF(cif, "otherFoo", 10L, pi)
# getting a string
cif = CIF(stringType)
ans = callCIF(cif, "retString")
print(ans)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.