Skip to content

Commit a8dbfa1

Browse files
committed
updates to testRcppClass
this example still triggers messages from R-devel CMD check after discussion with jmc, concluded that these may stem from the R side
1 parent 63fb5a0 commit a8dbfa1

File tree

7 files changed

+50
-6
lines changed

7 files changed

+50
-6
lines changed

ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2017-04-11 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* inst/inst/unitTests/testRcppClass/src/init.c (R_init_testRcppClass): Call
4+
R_registerRoutines() and R_useDynamicSymbols(); also ensure
5+
_rcpp_module_boot_* is registered for each module
6+
* inst/unitTests/testRcppClass/NAMESPACE: Added registration
7+
8+
* inst/unitTests/testRcppClass/DESCRIPTION (Title): Title case
9+
10+
* inst/unitTests/testRcppClass/R/rcpp_hello_world.R (rcpp_hello_world):
11+
Call the renamed C++ function
12+
* inst/unitTests/testRcppClass/src/rcpp_hello_world.cpp (rcpp_hello_world_cpp):
13+
Renamed C++ function to be distinct from R function calling it
14+
* inst/unitTests/testRcppClass/src/rcpp_hello_world.h: Ditto
15+
* inst/unitTests/testRcppClass/man/rcpp_hello_world.Rd: Alias renamed
16+
C++ function
17+
118
2017-04-09 Dirk Eddelbuettel <edd@debian.org>
219

320
* inst/unitTests/testRcppModule/src/init.c (R_init_testRcppModule): Call

inst/unitTests/testRcppClass/DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: testRcppClass
22
Type: Package
3-
Title: Some examples using Rcpp classes and loadModule()
3+
Title: Some Examples using Rcpp Classes and loadModule()
44
Version: 0.1
55
Date: 2012-04-06
66
Author: John Chambers
@@ -14,4 +14,4 @@ Depends: R (>= 2.15.0)
1414
Imports: Rcpp (>= 0.8.5), methods
1515
LinkingTo: Rcpp
1616
Packaged: 2012-04-14 18:42:28 UTC; jmc
17-
17+
NeedsCompilation: yes

inst/unitTests/testRcppClass/NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
useDynLib(testRcppClass)
1+
useDynLib(testRcppClass, .registration=TRUE)
22
import(Rcpp,methods)
33

44
export(genWorld, stdNumeric, rcpp_hello_world,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
rcpp_hello_world <- function(){
3-
.Call("rcpp_hello_world", PACKAGE = "testRcppClass")
3+
.Call("rcpp_hello_world_cpp", PACKAGE = "testRcppClass")
44
}
55

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <R.h>
2+
#include <Rinternals.h>
3+
#include <stdlib.h> // for NULL
4+
#include <R_ext/Rdynload.h>
5+
6+
/* FIXME:
7+
Check these declarations against the C/Fortran source code.
8+
*/
9+
10+
/* .Call calls */
11+
extern SEXP rcpp_hello_world_cpp();
12+
extern SEXP _rcpp_module_boot_NumEx();
13+
extern SEXP _rcpp_module_boot_RcppClassModule();
14+
extern SEXP _rcpp_module_boot_stdVector();
15+
16+
static const R_CallMethodDef CallEntries[] = {
17+
{"rcpp_hello_world_cpp", (DL_FUNC) &rcpp_hello_world_cpp, 0},
18+
{"_rcpp_module_boot_NumEx", (DL_FUNC) &_rcpp_module_boot_NumEx, 0},
19+
{"_rcpp_module_boot_RcppClassModule", (DL_FUNC) &_rcpp_module_boot_RcppClassModule, 0},
20+
{"_rcpp_module_boot_stdVector", (DL_FUNC) &_rcpp_module_boot_stdVector, 0},
21+
{NULL, NULL, 0}
22+
};
23+
24+
void R_init_testRcppModule(DllInfo *dll) {
25+
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
26+
R_useDynamicSymbols(dll, FALSE);
27+
}

inst/unitTests/testRcppClass/src/rcpp_hello_world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "rcpp_hello_world.h"
22

3-
SEXP rcpp_hello_world(){
3+
SEXP rcpp_hello_world_cpp(){
44
using namespace Rcpp ;
55

66
CharacterVector x = CharacterVector::create( "foo", "bar" ) ;

inst/unitTests/testRcppClass/src/rcpp_hello_world.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
#include <Rcpp.h>
55

6-
RcppExport SEXP rcpp_hello_world() ;
6+
RcppExport SEXP rcpp_hello_world_cpp() ;
77

88
#endif

0 commit comments

Comments
 (0)