[Rd] Linking to native routines in other packages

Dirk Eddelbuettel edd at debian.org
Wed Jan 22 13:39:17 CET 2014

Hi Gregor,

On 22 January 2014 at 11:53, Gregor Kastner wrote:
| in my package 'stochvol' I have unsuccessfully been trying to make a C
| routine called 'sampler' available to be called from other packages' C code.
| Following
| http://cran.r-project.org/doc/manuals/R-exts.html#Linking-to-native-routines-in-other-packages
| I have included
| #include <R_ext/Rdynload.h>
| R_init_stochvol(DllInfo *dll) {
|  R_RegisterCCallable("stochvol", "sampler", (DL_FUNC) sampler);
| }
| in some file within stochvol's 'src' directory, and
| DL_FUNC stochvol_sampler = R_GetCCallable("stochvol", "sampler");
| in some file within the 'src' directoy of the package depending on stochvol.
| When installing that package, I however get:
| Error in dyn.load(file, DLLpath = DLLpath, ...) : 
|   function 'sampler' not provided by package 'stochvol'
| Can somebody give me a hint what I am missing?

Working examples I know of:   

   'xts' importing two functions from 'zoo'

   'RcppXts' importing approx. ten functions from 'xts'

Maybe by comparing to these you can sort out the missing step at your end.


Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

More information about the R-devel mailing list