diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-27 18:35:56 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-27 21:19:19 +0100 |
commit | 1e3fd1bef2a0ec1c8b73fcfefdd62fd3463bc87c (patch) | |
tree | 22fc54a9ebb62487887e779639c91c56e3d55db9 /R/mkinpredict.R | |
parent | 503441b0a958c1df50df0ee7cfc3bde4ea1b1865 (diff) |
Improved way to have persistent DLLs for mkinmod
Depends on inline >= 0.16.2 (including the bug fixes from
eddelbuettel/inline#18), which provides 'moveDLL' to store the DLL for a
compiled function in a safe place in case the argument 'dll_dir' is
specified in the call to 'mkinmod'.
Huge thanks to Dirk @eddelbuettel for his review and support
for the work on the inline package.
Diffstat (limited to 'R/mkinpredict.R')
-rw-r--r-- | R/mkinpredict.R | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R index a294a114..277c3604 100644 --- a/R/mkinpredict.R +++ b/R/mkinpredict.R @@ -169,18 +169,13 @@ mkinpredict.mkinmod <- function(x, if (solution_type == "deSolve") { if (!is.null(x$cf) & use_compiled[1] != FALSE) { - DLL <- try(inline::getDynLib(x$cf)) - if (inherits(DLL, "try-error")) { - x$cf <- inline::readDynLib(x$cf_name, x$cf_dir) - } - cf_env <- environment(x$cf) out <- deSolve::ode( y = odeini, times = outtimes, - func = cf_env$name, + func = "diffs", initfunc = "initpar", - dllname = cf_env$f, + dllname = inline::getDynLib(x$cf)[["name"]], parms = odeparms[x$parms], # Order matters when using compiled models method = method.ode, atol = atol, |