Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# RcppParallel (development version)

* On Windows, RcppParallel once again loads its compatibility stub library
(`tbb.dll`) when the package is loaded. Packages linking with `-ltbb`
(e.g. via StanHeaders) record a load-time dependency on `tbb.dll`, which
can only be resolved if RcppParallel has already loaded it; with
RcppParallel 6.0.0, such packages would fail to load with "LoadLibrary
failure: The specified module could not be found".

* The bundled oneTBB headers now guard against GCC's `<cpuid.h>` being
included before `<intrin.h>` on Windows (mingw). Previously, translation
units including `<cpuid.h>` before any TBB header would fail to compile,
Expand Down
17 changes: 15 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@
.tbbMallocProxyDllInfo <- NULL

loadTbbLibrary <- function(name) {
# TBB is statically linked on Windows

# On Windows, TBB is statically linked into RcppParallel.dll, but we
# still ship a stub tbb.dll for compatibility with packages linking via
# '-ltbb' (e.g. through StanHeaders). Such packages record a load-time
# dependency on 'tbb.dll', which the Windows loader can only resolve if
# we've already loaded it -- the library directory itself is not on the
# DLL search path.
if (is_windows()) {
return(NULL)

path <- file.path(tbbRoot(), paste0(name, ".dll"))
if (!file.exists(path))
return(NULL)

return(dyn.load(path, local = FALSE, now = TRUE))

}

path <- tbbLibraryPath(name)
if (is.null(path))
return(NULL)
Expand Down
Loading