Skip to content

Commit 746c667

Browse files
committed
don't load sourceCpp dynamic library if it's already been loaded
1 parent 8aa449d commit 746c667

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2015-06-07 JJ Allaire <[email protected]>
2+
3+
* src/attributes.cpp: Don't load sourceCpp dynamic library if it's
4+
already been loaded
5+
16
2015-06-05 Dirk Eddelbuettel <[email protected]>
27

38
* R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Remove

inst/NEWS.Rd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
\itemize{
99
\item The sugar function \code{sapply} now supports lambda functions
1010
}
11+
\item Changes in Rcpp Attributes:
12+
\itemize{
13+
\item Don't load \code{sourceCpp} dynamic library if it's already
14+
been loaded.
15+
}
1116
\item Changes in Rcpp Documentation:
1217
\itemize{
1318
\item The \code{Rcpp-FAQ} vignette was once again updated with respect to

src/attributes.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,17 +2877,15 @@ namespace {
28772877
throw Rcpp::file_io_error(generatedRSourcePath());
28782878

28792879
// DLLInfo - hide using . and ensure uniqueness using contextId
2880-
std::string dllInfo = "`." + contextId_ + "_DLLInfo`";
2881-
rOfs << dllInfo << " <- dyn.load('" << dynlibPath() << "')"
2880+
std::string dllInfoName = "." + contextId_ + "_DLLInfo";
2881+
std::string dllInfo = "`" + dllInfoName + "`";
2882+
rOfs << "if (!exists('" << dllInfoName << "', inherits = FALSE))" << std::endl;
2883+
rOfs << " " << dllInfo << " <- dyn.load('" << dynlibPath() << "')"
28822884
<< std::endl << std::endl;
28832885

28842886
// Generate R functions
28852887
generateR(rOfs, sourceAttributes, dllInfo);
28862888

2887-
// remove the DLLInfo
2888-
rOfs << std::endl << "rm(" << dllInfo << ")"
2889-
<< std::endl;
2890-
28912889
rOfs.close();
28922890

28932891
// discover exported functions and dependencies

0 commit comments

Comments
 (0)