-
Notifications
You must be signed in to change notification settings - Fork 53
Replace Rcpp dependency with cpp11 #299
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,4 @@ | |
| ^docs$ | ||
| ^pkgdown$ | ||
| ^CRAN-SUBMISSION$ | ||
| ^\.vscode$ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ NEWS.html | |
| script.R | ||
| revdep/cloud.noindex | ||
| docs | ||
| .vscode | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| Package: pkgload | ||
| Title: Simulate Package Installation and Attach | ||
| Version: 1.4.0.9000 | ||
| Version: 1.4.0.9001 | ||
| Authors@R: c( | ||
| person("Hadley", "Wickham", role = "aut"), | ||
| person("Winston", "Chang", role = "aut"), | ||
| person("Jim", "Hester", role = "aut"), | ||
| person("Lionel", "Henry", , "[email protected]", role = c("aut", "cre")), | ||
| person("Mauricio", "Vargas Sepulveda", role = "ctb", | ||
| comment = c(ORCID = "0000-0003-1017-7574")), | ||
| person("Posit Software, PBC", role = c("cph", "fnd")), | ||
| person("R Core team", role = "ctb", | ||
| comment = "Some namespace and vignette code extracted from base R") | ||
|
|
@@ -20,6 +22,7 @@ Depends: | |
| R (>= 3.4.0) | ||
| Imports: | ||
| cli (>= 3.3.0), | ||
| decor, | ||
| desc, | ||
| fs, | ||
| glue, | ||
|
|
@@ -35,7 +38,7 @@ Suggests: | |
| jsonlite, | ||
| mathjaxr, | ||
| pak, | ||
| Rcpp, | ||
| cpp11, | ||
| remotes, | ||
| rstudioapi, | ||
| testthat (>= 3.2.1.1), | ||
|
|
@@ -48,3 +51,5 @@ Config/testthat/start-first: dll | |
| Encoding: UTF-8 | ||
| Roxygen: list(markdown = TRUE) | ||
| RoxygenNote: 7.3.2 | ||
| LinkingTo: | ||
| cpp11 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,4 @@ export(run_example) | |
| export(unload) | ||
| export(unregister) | ||
| import(rlang) | ||
| useDynLib(pkgload, .registration = TRUE) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Generated by cpp11: do not edit by hand | ||
|
|
||
| fun <- function() { | ||
| invisible(.Call(`_pkgload_fun`)) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,6 @@ | |
| "_PACKAGE" | ||
|
|
||
| ## usethis namespace: start | ||
| #' @useDynLib pkgload, .registration = TRUE | ||
| ## usethis namespace: end | ||
| NULL | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| side_effect_decor <- function() { | ||
| decor::parse_cpp_function("void fun() {}") | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| *.o | ||
| *.so | ||
| *.dll |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #include <cpp11.hpp> | ||
| using namespace cpp11; | ||
|
|
||
| // just for the side effect of registering the function | ||
| [[cpp11::register]] | ||
| void fun() {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Generated by cpp11: do not edit by hand | ||
| // clang-format off | ||
|
|
||
|
|
||
| #include "cpp11/declarations.hpp" | ||
| #include <R_ext/Visibility.h> | ||
|
|
||
| // code.cpp | ||
| void fun(); | ||
| extern "C" SEXP _pkgload_fun() { | ||
| BEGIN_CPP11 | ||
| fun(); | ||
| return R_NilValue; | ||
| END_CPP11 | ||
| } | ||
|
|
||
| extern "C" { | ||
| static const R_CallMethodDef CallEntries[] = { | ||
| {"_pkgload_fun", (DL_FUNC) &_pkgload_fun, 0}, | ||
| {NULL, NULL, 0} | ||
| }; | ||
| } | ||
|
|
||
| extern "C" attribute_visible void R_init_pkgload(DllInfo* dll){ | ||
| R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); | ||
| R_useDynamicSymbols(dll, FALSE); | ||
| R_forceSymbols(dll, TRUE); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| test_that("side effect decor", { | ||
| expect_type(side_effect_decor(), "list") | ||
| }) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Package: testDllcpp11 | ||
| Title: Test package for compiling DLLs that link to cpp11 | ||
| License: GPL (>= 3) | ||
| Description: Test package for compiling DLLs that link to cpp11. | ||
| Just for testing purposes. | ||
| Authors@R: c( | ||
| person("Hadley", "Wickham", role = c("aut", "cre"), | ||
| email = "[email protected]"), | ||
| person("Mauricio", "Vargas Sepulveda", role = "aut") | ||
| ) | ||
| Version: 0.1 | ||
| LinkingTo: | ||
| cpp11 | ||
| Roxygen: list(markdown = TRUE) | ||
| RoxygenNote: 7.3.2 | ||
| Encoding: UTF-8 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Generated by roxygen2: do not edit by hand | ||
|
|
||
| useDynLib(testDllcpp11, .registration = TRUE) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| cpp11.R |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #' @useDynLib testDllcpp11, .registration = TRUE | ||
| "_PACKAGE" | ||
|
|
||
| #' Hello World | ||
| #' @export | ||
| cpp11_hello_world <- function() { | ||
| cpp11_hello_world_() | ||
| } | ||
|
|
||
| #' Test Attributes | ||
| #' @export | ||
| cpp11_test_attributes <- function() { | ||
| cpp11_test_attributes_() | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| cpp11.cpp | ||
| *.o | ||
| *.so | ||
| *.dll |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #include <cpp11.hpp> | ||
| using namespace cpp11; | ||
|
|
||
| [[cpp11::register]] sexp cpp11_hello_world_() { | ||
| writable::strings x = {"foo", "bar"}; | ||
| writable::doubles y = {0.0, 1.0}; | ||
| writable::list z = {x, y}; | ||
|
|
||
| return z; | ||
| } | ||
|
|
||
| [[cpp11::register]] bool cpp11_test_attributes_() { | ||
| return true; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.