Skip to content

Commit 73b076e

Browse files
committed
Load the package library only if TBB is found
1 parent dbd6ca6 commit 73b076e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

R/hooks.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ mallocDllInfo <- NULL
2222
}
2323
}
2424

25-
# load the package library
26-
library.dynam("RcppParallel", pkgname, libname)
27-
25+
# load the package library if TBB library is found
26+
if (!is.null(dllInfo) | !is.null(mallocDllInfo)) {
27+
library.dynam("RcppParallel", pkgname, libname)
28+
} else {
29+
warning("Please install TBB library and reload the package!")
30+
}
2831
}
2932

3033
.onUnload <- function(libpath) {
3134

3235
# unload the package library
33-
library.dynam.unload("RcppParallel", libpath)
36+
if (!is.null(dllInfo) | !is.null(mallocDllInfo))
37+
library.dynam.unload("RcppParallel", libpath)
3438

3539
# unload tbb if we loaded it
3640
if (!is.null(dllInfo))

0 commit comments

Comments
 (0)