ID EN
Control Flow

Foreign

R Base 3.6.2

Functions to make calls to compiled code that has been loaded into R.

Syntax

R
.C(.NAME, …, NAOK = FALSE, DUP = TRUE, PACKAGE, ENCODING)
 .Fortran(.NAME, …, NAOK = FALSE, DUP = TRUE, PACKAGE, ENCODING)

Arguments

Parameter Description
.NAME a character string giving the name of a C function or Fortran subroutine, or an object of class "NativeSymbolInfo", "RegisteredNativeSymbol" or "NativeSymbol" referring to such a name.
… arguments to be passed to the foreign function. Up to 65.
NAOK if TRUE then any NA or NaN or Inf values in the arguments are passed on to the foreign function. If FALSE, the presence of NA or NaN or Inf values is regarded as an error.
PACKAGE if supplied, confine the search for a character string .NAME to the DLL given by this argument (plus the conventional extension, .so, .dll, …). This is intended to add safety for packages, which can ensure by using this argument that no other package can override their external symbols, and also speeds up the search (see ‘Note’).
DUP, ENCODING For back-compatibility, accepted but ignored.

Return Value

A list similar to the … list of arguments passed in (including any names given to the arguments), but reflecting any changes made by the C or Fortran code.

Details

These functions can be used to make calls to compiled C and Fortran 77 code. Later interfaces are .Call and .External which are more flexible and have better performance. These functions are primitive, and .NAME is always matched to the first argument supplied (which should not be named). The other named arguments follow … and so cannot be abbreviated. For clarity, should avoid using names in the arguments passed to … that match or partially match .NAME.

See Also

dyn.load .Call. The ‘Writing R Extensions’ manual.