Charles Geyer
2017-Jan-13 19:25 UTC
[Rd] calling native routines in another package (Sec 5.4.2 of Writing R Extensions)
I just (apparently) figured out how to do the stuff described in Section 5.4.2 of Writing R Extensions. I put my test toy packages on github <https://github.com/cjgeyer/linkingTo> for anyone to copy. If anyone cares to read the README and the bits of code it links to and tell me anywhere I am wrong, I would be grateful. But the main point of this e-mail is a complaint about that section of Writing R Extensions. It says (even in R-devel) "A CRAN example of the use of this mechanism is package lme4, which links to Matrix." but that does not appear to be true anymore. I cannot see any inclusion of headers from Matrix in lme4 nor any call to R_GetCCallable. I did find the file inst/include/Matrix_stubs.c in the Matrix package somewhat helpful (although mystifying at first). So this can be considered a documentation bug report (if I am correct). Do I need to do an official bugzilla one? Just a further check. lme4 (1.1-12) does not have Matrix in the LinkingTo field of its DESCRIPTION file, so headers from Matrix cannot be used. And grep R_Get *.[ch]* in the src directory of lme4 returns nothing.
Dirk Eddelbuettel
2017-Jan-13 20:58 UTC
[Rd] calling native routines in another package (Sec 5.4.2 of Writing R Extensions)
On 13 January 2017 at 13:25, Charles Geyer wrote: | I just (apparently) figured out how to do the stuff described in | Section 5.4.2 of | Writing R Extensions. I put my test toy packages on github | <https://github.com/cjgeyer/linkingTo> for anyone to copy. If anyone | cares to read the README and the bits of code it links to and tell me | anywhere I am wrong, I would be grateful. | | But the main point of this e-mail is a complaint about that section of | Writing R Extensions. It says (even in R-devel) "A CRAN example of | the use of this mechanism is package lme4, which links to Matrix." but | that does not appear to be true anymore. I cannot see any inclusion | of headers from Matrix in lme4 nor any call to R_GetCCallable. I did | find the file inst/include/Matrix_stubs.c in the Matrix package | somewhat helpful (although mystifying at first). | | So this can be considered a documentation bug report (if I am | correct). Do I need to do an official bugzilla one? | | Just a further check. lme4 (1.1-12) does not have Matrix in the | LinkingTo field of its DESCRIPTION file, so headers from Matrix cannot | be used. And | | grep R_Get *.[ch]* | | in the src directory of lme4 returns nothing. There are a few other packages doing this RcppXts uses exported C code from xts [1] RcppRedis users export C code from RApiSerialize RcppKalman uses expm Vincent Goulet just release expint which offers an API Dirk [1] Vincent and I went over this recently when he prepared expint. While I (re-)wrote a large part of the xts header for use by RcppXts and others, I didn't leave my name in the header so Jeff got author credits for expint instead. C'est la vie. -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org