gen_registration: Generate registration from fortran subroutine

View source: R/registration.R

gen_registrationR Documentation

Generate registration from fortran subroutine

Description

This uses uses implicit fortran conventions

Usage

gen_registration(pkg_name, fun_list, callEntries = NULL)

Arguments

pkg_name

the package name as character

fun_list

the list of fortran function prototypes, see example

callEntries

a character vector defining code that will be included verbatim that will define the C array CallEntries[], default NULL

Value

lines that can be written into an init file for the package

Examples

## Most common use
fns <- c("subroutine pclasso(no,ni,x,y,w,theta,ng,mg,aa,ne,nx,nlam,ulam,thr,maxit,verbose,ao,ia,kin,nlp,jerr)", "subroutine logpclasso(no,ni,x,y,w,theta,ng,mg,aa,ne,nx,nlam,ulam,thr,maxit,verbose,a0,ao,ia,kin,nlp,jerr)")
# Generate lines that can be written into pcLasso/src/pcLasso_init.c for example
gen_registration("pcLasso", fns)

## Example using callEntries
callEntries <- c(
  'extern SEXP store_rfun(SEXP rfun);',
  'static const R_CallMethodDef CallEntries[] = {',
     '{"store_rfun", (DL_FUNC) &store_rfun, 1}',
     '{NULL, NULL, 0}',
  '};')
gen_registration("pcLasso", fns, callEntries = callEntries)


bnaras/SUtools documentation built on Nov. 26, 2022, 6:07 p.m.