From edd at debian.org  Wed Jan 22 13:39:17 2014
From: edd at debian.org (Dirk Eddelbuettel)
Date: Wed, 22 Jan 2014 06:39:17 -0600
Subject: [Rd] Linking to native routines in other packages
In-Reply-To: <20140122115341.66ebf717@mine>
References: <20140122115341.66ebf717@mine>
Message-ID: <21215.48117.939482.501106@max.nulle.part>


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

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



[Rd] Linking to native routines in other packages
Dirk Eddelbuettel