asFunctionPointer: Convert an object to a pointer to a native routine

asFunctionPointerR Documentation

Convert an object to a pointer to a native routine

Description

(This looks incomplete.)

This function is used to coerce a value to a reference to a native routine. We also have methods for coerce to do this for strings and NativeSymbolInfo and NativeSymbol objects. However, this function is capable of doing more than simple coercion but testing whether the object is compatible with the native routine. That means we test the number of parameters and their types.

Usage

asFunctionPointer(obj, numParams, paramTypes = NULL, test = TestFunctionPointers)

Arguments

obj

the object to be converted.

numParams

the number of parameters the routine will be passed

paramTypes

a list giving the types of the parameters. If the we have information about the C routine or about the types of the R function's parameters, we can check that these are compatible with the expected function pointer types. Note that we don't check the return type here!

test

a logical value which controls whether we test the number and types of parameters for R functions passed as obj. If the obj is of class "AsIs", i.e. given as I(obj), then this argument is ignored.

Value

obj, or an error is raised.

Author(s)

Duncan Temple Lang

See Also

coerce,character,RNativeRoutineReference-method


omegahat/RAutoGenRunTime documentation built on Jan. 12, 2023, 9:19 p.m.