[Rd] compiling C code using headers from another R package
Kevin Horan
khoran at cs.ucr.edu
Mon Mar 11 22:20:24 CET 2013
I am developing an R package, eiR, which depends on another C library,
GNU scientific library (GSL). In order to make life easier for the user,
it would be nice to not have this as an external dependency, thus I
would like to wrap this library in another R package, say GSLR for
example. Thus far I know how to do this. The C code in eiR requires the
.so library and the header files from GSL in order to compile. So the
idea is that eiR would depend on GSLR, then GSLR gets compiled and
installed first, then, while eiR is installing, it should be able to
make use of the GSL library and header files while compiling. So my
question is, how do I know where the GSL library and header files,
packaged in GSLR, would live so I can point the compiler at them? I know
how to find the installed directory of an R package from within R, but
is there way to find that out using just Makevars or a Makefile? I'm
open to suggestions about a better way organize all of this as well. I
like the idea of keeping the GSL code separate so that it can be
updated/changed independently from eiR though.
I'm also aware of the gsl R library on CRAN, however, this just
wraps GSL in R functions, but I need to use the GSL C functions in other
C code in eiR.
Thanks.
Kevin
More information about the R-devel
mailing list