[Rcpp-commits] r1068 - in pkg/Rcpp: R inst/include inst/unitTests/RcppTestA/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Apr 18 21:42:36 CEST 2010
Author: romain
Date: 2010-04-18 21:42:35 +0200 (Sun, 18 Apr 2010)
New Revision: 1068
Modified:
pkg/Rcpp/R/Rcpp.package.skeleton.R
pkg/Rcpp/R/cppfunction.R
pkg/Rcpp/inst/include/RcppCommon.h
pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
Log:
add windows exception forwarding to skeleton and test package
Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R
===================================================================
--- pkg/Rcpp/R/Rcpp.package.skeleton.R 2010-04-18 19:31:29 UTC (rev 1067)
+++ pkg/Rcpp/R/Rcpp.package.skeleton.R 2010-04-18 19:42:35 UTC (rev 1068)
@@ -89,6 +89,19 @@
message( " >> added Makevars.win file with Rcpp settings" )
}
+ zzz <- file.path( src, "zzz.cpp" )
+ writeLines( sprintf('
+#include <RcppCommon.h>
+/* this helps exception forwarding on windows */
+
+#if defined(WIN32)
+extern "C" R_init_%s( DllInfo* info){
+ std::set_terminate( forward_uncaught_exceptions_to_r ) ;
+}
+#endif
+', name), zzz )
+ message( ">> added windows exception forwarding helper file zzz.cpp" )
+
if( example_code ){
header <- readLines( file.path( skeleton, "rcpp_hello_world.h" ) )
header <- gsub( "@PKG@", name, header, fixed = TRUE )
Modified: pkg/Rcpp/R/cppfunction.R
===================================================================
--- pkg/Rcpp/R/cppfunction.R 2010-04-18 19:31:29 UTC (rev 1067)
+++ pkg/Rcpp/R/cppfunction.R 2010-04-18 19:42:35 UTC (rev 1068)
@@ -51,8 +51,7 @@
functions <- sapply( calls, function(.){ if( is.name(.[[1]]) ) as.character( .[[1]]) else "" } )
if( "cppfunction" %in% functions ){
sprintf(
-'#include <R_ext/Rdynload.h>
-%s
+'%s
#if defined(WIN32)
extern "C" void R_init_%s( DllInfo* info ){
std::set_terminate( forward_uncaught_exceptions_to_r ) ;
Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h 2010-04-18 19:31:29 UTC (rev 1067)
+++ pkg/Rcpp/inst/include/RcppCommon.h 2010-04-18 19:42:35 UTC (rev 1068)
@@ -122,6 +122,7 @@
#include <R_ext/Callbacks.h>
#include <R_ext/Complex.h>
#include <R_ext/Parse.h>
+#include <R_ext/Rdynload.h>
#include <Rversion.h>
#define RCPP_GET_NAMES(x) Rf_getAttrib(x, R_NamesSymbol)
Modified: pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp 2010-04-18 19:31:29 UTC (rev 1067)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp 2010-04-18 19:42:35 UTC (rev 1068)
@@ -7,3 +7,9 @@
List z = List::create( x, y ) ;
return z ;
}
+
+#if defined(WIN32)
+extern "C" R_init_RcppTestA( DllInfo* info){
+ std::set_terminate( forward_uncaught_exceptions_to_r ) ;
+}
+#endif
More information about the Rcpp-commits
mailing list