Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatically register init functions for RcppModules (closes #704)#705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
eddelbuettel merged 2 commits intomasterfromfeature/module-routine-registraiton
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from1 commit
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
NextNext commit
Automatically register init functions for RcppModules
  • Loading branch information
@jjallaire
jjallaire committedJun 2, 2017
commit8f404dfbe66043c3c7191d71be5101bdee6eade5
4 changes: 4 additions & 0 deletionsChangeLog
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
2017-06-02 JJ Allaire <jj@rstudio.com>

* src/attributes.cpp: Automatically register init functions for RcppModules

2017-06-01 JJ Allaire <jj@rstudio.com>

* src/attributes.cpp: Fix registration for exports with name attribute.
Expand Down
1 change: 1 addition & 0 deletionsinst/NEWS.Rd
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,7 @@
or newer (Elias Pipping in \ghpr{698}).
\item Fix native registration for exports with name attribute (\ghpr{703}
addressing \ghit{702}).
\item Automatically register init functions for RcppModules.
}
}
}
Expand Down
20 changes: 18 additions & 2 deletionssrc/attributes.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -675,8 +675,11 @@ namespace attributes {
// for generating C++ interfaces
std::vector<Attribute> cppExports_;

// for generating native routine registration
// for generatingRcpp::exportnative routine registration
std::vector<Attribute> nativeRoutines_;

// for generating module native routine registration
std::vector<std::string> modules_;
};

// Class which manages generating PackageName_RcppExports.h header file
Expand DownExpand Up@@ -1888,6 +1891,9 @@ namespace attributes {
}
} // #nocov end

// record modules
const std::vector<std::string>& modules = attributes.modules();
modules_.insert(modules_.end(), modules.begin(), modules.end());

// verbose if requested
if (verbose) {// #nocov start
Expand DownExpand Up@@ -1955,7 +1961,7 @@ namespace attributes {
}

// write native routines
if (!hasPackageInit && !nativeRoutines_.empty()) {
if (!hasPackageInit &&(!nativeRoutines_.empty() || !modules_.empty())) {

// build list of routines we will register
std::vector<std::string> routineNames;
Expand All@@ -1965,6 +1971,11 @@ namespace attributes {
routineNames.push_back(package() + "_" + attr.function().name());
routineArgs.push_back(attr.function().arguments().size());
}
std::string kRcppModuleBoot = "_rcpp_module_boot_";
for (std::size_t i=0;i<modules_.size(); i++) {
routineNames.push_back(kRcppModuleBoot + modules_[i]);
routineArgs.push_back(0);
}
if (hasCppInterface()) {
routineNames.push_back(registerCCallableExportedName());
routineArgs.push_back(0);
Expand All@@ -1976,6 +1987,11 @@ namespace attributes {
std::vector<std::string> declarations = extraRoutines["declarations"];
std::vector<std::string> callEntries = extraRoutines["call_entries"];

// add declarations for modules
for (std::size_t i=0;i<modules_.size(); i++) {
declarations.push_back("RcppExport SEXP " + kRcppModuleBoot + modules_[i] + "();");
}

// generate declarations
if (declarations.size() > 0) {
ostr() << std::endl;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp