Bind a package to the Julia library
Source: R/runtime.R
Description
Call this from the .onLoad() of a package that uses jlbind; use_jlbind() sets that up. The first call loads the compiled library, and each call binds one package’s routines to it. If the library is missing or was built from another version of the package, the package isn’t bound and its functions give an error; check_bound() says why.
Usage
bind_client(pkg)Arguments
pkg
|
The package name. |
Details
The library is the one from install_library(), unless JLBIND_LIBRARY names another, or the first package bound was loaded with pkgload::load_all() and has one from build_library(). That library is rebuilt as the package loads if it is out of date with the package’s sources, as when its Julia code has changed. A library that has already loaded cannot be replaced, so after a change, restart R.
To run Julia with more threads, set JULIA_NUM_THREADS (a number or "auto") before loading the first package that uses jlbind.
Value
Invisibly, TRUE if the package is bound and FALSE if not.
Examples
# In a package's R/jlbind.R, as use_jlbind() writes it
.onLoad <- function(libname, pkgname) {
jlbind::bind_client(pkgname)
}