registerFunctions: Automatically Register C/C++ Functions in a Package

Description Usage Arguments Details

View source: R/registerFunctions.R

Description

This function can be used to automatically register the native routines in a package. It searches all of the .c and .cpp files in src, excluding the file <pkgname>_init.c, finds functions annotated with // [[register]], and extracts the required information needed to register routines in the package. The necessary routines are written to a file called src/<pkgname>_init.c.

Usage

1
registerFunctions(prefix = "C_")

Arguments

prefix

A prefix to append to the exported name, so that a function called myfun is registered as <prefix>myfun.

Details

This function should be called from the base directory of an R package you are developing.

Currently, the assumption is that all functions in a package use the .Call interface; i.e., there are no functions using the .C, .Fortran, or .External interfaces – this may be added in a future version.

After calling this function, ensure that you have useDynLib(<pkg>, .registration=TRUE) in your NAMESPACE. If you use roxygen to document your package, you can use

##' @useDynLib <pkg>, .registration=TRUE

somewhere in your roxygen documentation to achieve the same effect.


kevinushey/Kmisc documentation built on May 20, 2019, 9:08 a.m.