Skip to content

[R-sig-dyn-mod] Using dynamically compiled code for use with deSolve in a new package

3 messages · Rampal S. Etienne, Thomas Petzoldt

#
Dear Thomas,

Thanks again for this reply. While this may work locally and for some
users, it does not work in my case where my namespace file is generated
by roxygen2. Also, CRAN does not like dll-file to be in the package
(inst folder), so it needs to be built at installation. How do I do
this? Simply including the Fortran code in the src directory does not
work (gives error 127, whatever that is). Any suggestions?

Cheers, Rampal
On 11-6-2017 21:15, Thomas Petzoldt wrote:
#
Hi,

including Fortran and/or C sources in /src is exactly what we (and the 
other CRAN authors) do. It is self-evident, that binary code (like dlls) 
cannot be included in portable packages, that are expected to run on 
different operating systems. Details are found in "Writing R Extensions".

I don't see a problem with roxygen2, this is exactly how it was 
implemented in package "growthrates", mentioned earlier. Let's assume we 
have a package called "foo", add the following roxygen-directives to a 
file "R/foo-package.R":

#' @useDynLib foo
#'
#' @importFrom deSolve ode

Hope it helps,

Thomas
On 29.11.2017 14:44, Rampal S. Etienne wrote:
#
Hi Thomas,

Thanks. I got it to work. The solution was to not let roxygen do the
namespace file, as it overwrites the line containing useDynLib.

Cheers, Rampal
On 29-11-2017 23:30, Thomas Petzoldt wrote: