Skip to content
Prev 8370 / 12125 Next

[R-pkg-devel] Fwd: src/ subdirectories contains sources....

Le 30/08/2022 ? 14:14, RICHET Yann a ?crit?:
These files are coming from the library that you want to wrap. You still 
have to add an actual wrapper, i.e. your own code that will take SEXP 
arguments convert them in C type variables needed by the wrapped lib and 
once got the result from a lib call to convert it back to SEXP and 
return to R world. For example, the nloptr package (you are inspired 
off) has src/nloptr.c where it defines a function

 ?? SEXP NLoptR_Optimize( SEXP args ) {...}

and in R/nloptr.R it is called with

 ?? solution <- .Call( "NLoptR_Optimize", ret, PACKAGE = "nloptr" )

In now days, using Rcpp for lib wrapping is much more tractable solution 
(IMHO). So you can look over there.

Best,
Serguei.