createRegistrationCode: Generate code to register narive routines callable from R

View source: R/register.R

createRegistrationCodeR Documentation

Generate code to register narive routines callable from R

Description

This is a high-level function to find the routines in C/C++ code that can be invoked via R's .C or .Call interface and then to generate the C code to register these routines along with the number of parameters and their type information.

Usage

createRegistrationCode(dir, pkg = basename(dirname(dir)),
                          routines = getCallableRoutines(dir, ...), ...)

Arguments

dir

the directory containing the source code.

pkg

the name of the package or DLL containing the native code. This is used when creating the name of the initialization routine that R will look for and invoke. This defaults to the name of the parent directory which corresponds to the case where the code is in the src/ directory of a package and the parent directory is the root of the package structure.

routines

the collection of .C and .Call invocable routines

...

additional parameters such as args and includes that are passed to createTU when parsing the source files(s).

Value

A string that contains the C code for registering the routines along with the data declarations it uses.

Author(s)

Duncan Temple Lang

See Also

getCallableRoutines

Examples

  code = createRegistrationCode(system.file("exampleCode", package = "RCIndex"), "MyPkg")
  cat(code, sep = "\n")

omegahat/RClangSimple documentation built on Aug. 17, 2024, 10:23 a.m.