| 1 |
\name{pkgLibs} |
| 2 |
\alias{pkgLibs} |
| 3 |
\title{R Package Compiled Code Library Dependencies (on Unix-alikes)} |
| 4 |
\description{ |
| 5 |
List some system level information about the compiled code library, |
| 6 |
typically its dependencies, for \R packages with compiled code; for |
| 7 |
Unix-alikes or more generally when \code{cmd} is installed locally. |
| 8 |
} |
| 9 |
\usage{ |
| 10 |
pkgLibs(pkg, |
| 11 |
cmd = if(Sys.info()[["sysname"]] == "Darwin") "otool -L" else "ldd") |
| 12 |
} |
| 13 |
\arguments{ |
| 14 |
\item{pkg}{\code{\link{character}} vector of package names of |
| 15 |
\emph{installed} \R packages.} |
| 16 |
\item{cmd}{a \code{character} string with the name of an OS / system |
| 17 |
level program (to be called via \code{\link{system}(cmd, ..)}) which |
| 18 |
gives information about the shared library (of compiled code), also |
| 19 |
known as \dQuote{DLL} (dynamically loadable library) or |
| 20 |
\dQuote{so} ((dynamic) shared object) library. The default, |
| 21 |
\command{"ldd"} is a standard binary utility on Unix-alike platforms |
| 22 |
such as Linux. On macOS, \command{"oTool -L"} is used by default.} |
| 23 |
} |
| 24 |
\details{ |
| 25 |
Note that there seems some language confusion as \dQuote{DLL} on Windows |
| 26 |
is \emph{also} used for \dQuote{Dynamic-link Library} and Wikipedia warns about |
| 27 |
confusing the two concepts (\dQuote{dynamically loaded ..} vs |
| 28 |
\dQuote{dynamic-link ..}). |
| 29 |
} |
| 30 |
\value{ |
| 31 |
a named \code{\link{list}} with one entry per package in \code{pkg}, the |
| 32 |
\code{\link{names}} being the directory / folder names of the |
| 33 |
corresponding pkgs from \code{pkg}. |
| 34 |
|
| 35 |
The exact structure of such entries is currently subject to change and |
| 36 |
you should not rely on its exact format for now. |
| 37 |
} |
| 38 |
\references{ |
| 39 |
\sQuote{Dynamic Loading} on Wikipedia, |
| 40 |
\url{https://en.wikipedia.org/wiki/Dynamic_loading} |
| 41 |
|
| 42 |
On Windows, \dQuote{DLL} is also used for Dynamic-link library, |
| 43 |
\url{https://en.wikipedia.org/wiki/Dynamic-link_library}. |
| 44 |
|
| 45 |
\command{man ldd} from a terminal on a valid OS. |
| 46 |
} |
| 47 |
\author{Martin Maechler} |
| 48 |
\seealso{ |
| 49 |
\code{\link{dyn.load}()}, |
| 50 |
\code{\link{library.dynam}()}, and \code{\link{getLoadedDLLs}()}. |
| 51 |
|
| 52 |
Also, \code{\link{.C}}, \code{\link{.Call}} which use such DLLs. |
| 53 |
} |
| 54 |
\examples{ |
| 55 |
# for the example only using standard R packages : |
| 56 |
myPkgs <- c("stats", "MASS", "rpart", "Matrix") |
| 57 |
pl <- pkgLibs(myPkgs) |
| 58 |
pl |
| 59 |
stopifnot(exprs = { |
| 60 |
is.list(pl) |
| 61 |
length(pl) == length(myPkgs) |
| 62 |
is.character(pkgD <- names(pl)) |
| 63 |
}) |
| 64 |
## Have seen this failing when a strange development version of "Matrix" was picked up: |
| 65 |
try( stopifnot( dir.exists(pkgD)) ) |
| 66 |
} |
| 67 |
\keyword{interface} |