The goal of cbuild is to provide tools for working with C both interactively and when constructing an R package. The two broad goals are:
Provide an automatic registration system for R package developers that use C, see
process_attributes(). It can automatically generate the
init.c file for you, using a comment system similar to
Rcpp::export. For example, the following would generate an entry for the C function
init.c, and generate the glue code to export it as an R routine named
fn, which you could call from the R side with
You can install the development version from GitHub with:
The easiest way to get started is with
source_function(), which allows you to source a C function from text. It automatically includes
Rinternals.h for you to use.
From there, you can use
source_code() to source larger chunks of code. Tag functions that you want to export with
// [[ export() ]].
If you have a full file to source, you can use