[R-pkg-team] Bug in r-base and r-cran-rcppparallel

Johannes Ranke johannes.ranke at jrwb.de
Thu Feb 11 11:50:57 GMT 2021


Am Donnerstag, 11. Februar 2021, 12:20:33 CET schrieb Bastian Blank:
> Hi Johannes

Hello Bastian!

> On Thu, Feb 11, 2021 at 09:26:48AM +0100, Johannes Ranke wrote:
> > dyn.load is used in base R to load compiled code from R packages.
> 
> Can you show some examples please?  I know C and POSIX, but not much
> about R.

Well, in a nutshell, loading a package in R means calling library [1] which in 
turn calls loadNamespace [2] which, if the package uses compiled code, calls 
library.dynam [3], which uses dyn.load [4] after normalizing the path to the 
DLL.

So if you load e.g. the package MASS in R, dyn.load is called:

R> debug(dyn.load) 
R> library(MASS) 
debugging in: dyn.load(file, DLLpath = DLLpath, ...) 
debug: .Internal(dyn.load(x, as.logical(local), as.logical(now), "")) 
Browse[2]> x 
[1] "/usr/local/lib/R/site-library/MASS/libs/MASS.so" 

...

> > The documentation of dyn.load says that it accepts a path to a dynamic
> > shared object. Do we need more than that?
> 
> So my change is no problem, because it only changes the behaviour for
> 'dyn.load("object.so")', but not for
> 'dyn.load("/home/foo/projects/bar/object.so")'.
> 
> The documentation does not list a search behaviour for bare library
> names on non-Windows systems.  So completely ignoring the system library
> paths is kind of weird.

I can see that it looks weird - but is it a bug?

Johannes

[1] https://github.com/wch/r-source/blob/trunk/src/library/base/R/
library.R#L54 

[2] https://github.com/wch/r-source/blob/trunk/src/library/base/R/
namespace.R#L185 

[3] https://github.com/wch/r-source/blob/trunk/src/library/base/R/
library.R#L572 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/r-pkg-team/attachments/20210211/55c0d3e8/attachment.html>


More information about the R-pkg-team mailing list