[R] Repeated use of dyn.load().

Rui Barradas ruipbarradas at sapo.pt
Thu Mar 1 13:21:14 CET 2018


In such cases, with C code, I call dyn.unload before loading the 
modified shared lib again.
I don't know if this changed recently, but it used to be needed or else 
R wouldn't load the new lib. When I call dyn.unload followed by dyn.load 
I never had problems.
(Or the other way around, call dyn.unload before modifying the C code.)

Hope this helps,

Rui Barradas

On 3/1/2018 8:52 AM, Rolf Turner wrote:
> I am working with a function "foo" that explicitly dynamically loads a 
> shared object library or "DLL", doing something like dyn.load("bar.so"). 
>   This is a debugging exercise so I make changes to the underlying 
> Fortran code (yes, I acknowledge that I am a dinosaur) remake the DLL 
> "bar.so" and then run foo again.  This is all *without* quitting and 
> restarting R.  (I'm going to have to do this a few brazillion times, and
> I want the iterations to be as quick as possible.)
> This seems to work --- i.e. foo seems to obtain the latest version of 
> bar.so.  But have I just been lucky so far?  (I have not experimented 
> heavily).
> Am I running risks of leading myself down the garden path?  Are there 
> Traps for Young (or even Old) Players lurking about?
> I would appreciate Wise Counsel.
> cheers,
> Rolf Turner

More information about the R-help mailing list