Skip to content

[R-sig-dyn-mod] [R] deSolve, unresolved namespace error

3 messages · Adam Clark, Thomas Petzoldt

#
Many thanks - attached is an example that is replicable on my system,
Ubuntu 13.10, both in RStudio and R vanilla. This is NOT replicatable on a
Mac, nor on a Linux cluster running Centros 5.5

It includes the C code that I am trying to run in deSolve, along with an R
script to run the example.

It seems to be connected to re-loading the DLL for the C function that I am
running within ode. If I unload and reload the file, as I've done here,
deSolve ceases to work for all functions (as you say, ODEPACK is locked,
but never unlocked). However, even just calling "dyn.load(bmod.so)" a
second time without unloading it will cause the problem.

This isn't terribly urgent, since I've found a workaround (included in the
example) - But -- if there is a more elegant solution, I would love to try
it.

Thanks agian,
Adam
On Wed, Nov 6, 2013 at 3:56 PM, Thomas Petzoldt <thpe at simecol.de> wrote:

            

  
    
#
Hi Adam,

your example works perfectly on my Windows 7 / R 3.0.2 both 64 bit.

The only thing that does not work is the (in my case unnecessary)
loading/unloading of deSolve.[dll|so], which is no surprise because your
manual attempt to load it does not respect the package namespace.

Note also that you use an RK solver (ode23), that does NOT use locking.

I have no idea what should go wrong, maybe it's a system specific
problem or a memory problem of your C code? Have you already tried to
use valgrind?

Thomas

PS: What does "NOT replicable" mean? Does it mean that the model does
not run or that there is no error?
1 day later
#
We have been able to reproduce the reported issue on another Linux
system: Fedora 19, and the solution was quite simple:

The deSolve package must always to be loaded *before* loading the shared
library of the compiled model.

Thomas