Skip to content

Commit

Permalink
Merge pull request #697 from RcppCore/bugfix/pkg-dir-routine-registra…
Browse files Browse the repository at this point in the history
…tion

use pkg dir rather that getwd() for native routine registration
  • Loading branch information
jjallaire committed May 23, 2017
2 parents 48b13bc + 76090d3 commit 66612ae
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2017-05-23 JJ Allaire <jj@rstudio.com>

* R/Attributes.R: Execute tools::package_native_routine_registration_skeleton
within package rather than current working directory.
* src/attributes.cpp: Execute tools::package_native_routine_registration_skeleton
within package rather than current working directory.

2017-05-22 Dirk Eddelbuettel <edd@debian.org>

* R/inline.R (Rcpp.plugin.maker): Whitespace changes
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Rcpp
Title: Seamless R and C++ Integration
Version: 0.12.11
Version: 0.12.11.1
Date: 2017-05-20
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou,
Nathan Russell, Douglas Bates and John Chambers
Expand Down
7 changes: 5 additions & 2 deletions R/Attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ sourceCppFunction <- function(func, isVoid, dll, symbol) {
as.character(token)
}

.extraRoutineRegistrations <- function(routines) {
.extraRoutineRegistrations <- function(targetFile, routines) {

declarations = character()
call_entries = character()
Expand All @@ -1163,11 +1163,14 @@ sourceCppFunction <- function(func, isVoid, dll, symbol) {
# to automatically discover additional native routines that require registration
if (getRversion() >= "3.4") {

# determine the package directory
pkgdir <- dirname(dirname(targetFile))

# get the generated code from R
con <- textConnection(object = NULL, open = "w")
on.exit(close(con), add = TRUE)
tools::package_native_routine_registration_skeleton(
dir = ".",
dir = pkgdir,
con = con,
character_only = FALSE
)
Expand Down
10 changes: 10 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}

\section{Changes in Rcpp version 0.12.12 (Unreleased)}{
\itemize{
\item Changes in Rcpp Attributes:
\itemize{
\item Execute tools::package_native_routine_registration_skeleton
within package rather than current working directory.
}
}
}

\section{Changes in Rcpp version 0.12.11 (2017-05-20)}{
\itemize{
\item Changes in Rcpp API:
Expand Down
2 changes: 1 addition & 1 deletion src/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,7 @@ namespace attributes {

// see if there are additional registrations to perform
Rcpp::Function extraRoutinesFunc = Environment::namespace_env("Rcpp")[".extraRoutineRegistrations"];
List extraRoutines = extraRoutinesFunc(routineNames);
List extraRoutines = extraRoutinesFunc(targetFile(), routineNames);
std::vector<std::string> declarations = extraRoutines["declarations"];
std::vector<std::string> callEntries = extraRoutines["call_entries"];

Expand Down

0 comments on commit 66612ae

Please sign in to comment.