Skip to content

Commit ae5fe8f

Browse files
committed
Revert changes to modules related to BEGIN/END macros
It appears as if moving the BEGIN/END handling out to the highest level of the modules code allowed exceptiosn to propagate across the boundary between user DLLs and the Rcpp DLL, thus causing a crash on Windows. This changes reverts all of the modules related changes to BEGIN/END handling, essentially leaving them exactly as they were (and allowing our tests to continue passing). AFAIK we need to either do this or need to rework the modules code so that the exceptions no longer propagate (I don't think just surpressing the test on Windows is an option as this represents a change in behavior which may crash packages currently on CRAN).
1 parent ff3b8ef commit ae5fe8f

File tree

5 files changed

+566
-159
lines changed

5 files changed

+566
-159
lines changed

inst/include/Rcpp/InternalFunctionWithStdFunction.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ namespace Rcpp {
3838
virtual ~CppFunctionBaseFromStdFunction() {}
3939

4040
SEXP operator()(SEXP* args) {
41+
BEGIN_RCPP
4142
auto result = call<RESULT_TYPE, Args...>(fun, args);
4243
return Rcpp::module_wrap<RESULT_TYPE>(result);
44+
END_RCPP
4345
}
4446

4547
private:
@@ -53,8 +55,9 @@ namespace Rcpp {
5355
virtual ~CppFunctionBaseFromStdFunction() {}
5456

5557
SEXP operator()(SEXP* args) {
58+
BEGIN_RCPP
5659
call<void, Args...>(fun, args);
57-
return R_NilValue;
60+
END_RCPP
5861
}
5962

6063
private:

inst/include/Rcpp/api/meat/module/Module.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module.h: Rcpp R/C++ interface class library -- Rcpp modules
22
//
3-
// Copyright (C) 2013 - 2015 Romain Francois
3+
// Copyright (C) 2013 Romain Francois
44
//
55
// This file is part of Rcpp.
66
//
@@ -37,10 +37,12 @@ namespace Rcpp {
3737
}
3838

3939
inline CppClass Module::get_class( const std::string& cl ){
40+
BEGIN_RCPP
4041
CLASS_MAP::iterator it = classes.find(cl) ;
4142
if( it == classes.end() ) throw std::range_error( "no such class" ) ;
4243
std::string buffer ;
4344
return CppClass( this, it->second, buffer ) ;
45+
END_RCPP
4446
}
4547

4648
}

0 commit comments

Comments
 (0)