Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plugins

Plugin system for cxxfunction


Description

cxxfunction uses a plugin system to assembly the code that it compiles. These functions allow to register and get plugins by their name.

Usage

getPlugin(name, ...)
registerPlugin(name, plugin)

Arguments

name

name of the plugin.

...

Further argments to pass to the plugin.

plugin

plugin function.

Details

plugins are functions that return a list with :

includes

mandatory. it is included at the top of the compiled file by cxxfunction

body

optional. a function that takes one argument (the body of the c++ function) and returned a modified version of the body. The "Rcpp" plugin uses this to surround the code with the BEGIN_RCPP and END_RCPP macros

LinkingTo

optional. character vector containing the list of packages that the code needs to link to. This adds the include path of the given packages. The "Rcpp" and "RcppArmadillo" plugins use this.

env

optional. named list of environment variables. For example, the "Rcpp" plugin uses this to add Rcpp user library to the PKG_LIBS environment variable.

plugins can be manually registered using the registerPlugin function. Alternatively, a package may supply an inline plugin implicitely by defining a function called inlineCxxPlugin, which does not necessarily need to be exported from the namespace of the package.

Known packages implementing this scheme include Rcpp and RcppArmadillo.

Value

getPlugin retrieves the plugin and invokes it with the ... arguments

registerPlugin does not return anything.

See Also

Examples

## Not run: 
getPlugin( "Rcpp" )

## End(Not run)

inline

Functions to Inline C, C++, Fortran Function Calls from R

v0.3.17
LGPL
Authors
Oleg Sklyar, Duncan Murdoch, Mike Smith, Dirk Eddelbuettel, Romain Francois, Karline Soetaert, Johannes Ranke
Initial release
2020-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.