[Rcpp-devel] Problem with exceptions from standalone functions (Windows only)

Dirk Eddelbuettel edd at debian.org
Thu Jun 13 13:30:28 CEST 2013


Hi Ben,

Thanks for the nice email.  

On 13 June 2013 at 08:17, QRD wrote:
| For an only-mildly-ugly workaround, I put a BEGIN_RCPP / END_RCPP pair
| around the call in the CppFunction1<OUT, U0> template class (c. line 104
| in Module_generated_CppFunction.h):
| 
|     SEXP operator()(SEXP* args) {
| 
|         BEGIN_RCPP    // <<-- ADD THIS
| 
|         return Rcpp::module_wrap<OUT>( ptr_fun( /* ... */ ) );
| 
|         END_RCPP      // <<-- AND THIS
| 
|     }
| 
| This is a template, so it gets compiled into my DLL, the exception never
| leaves my DLL, and all is well.
| 
| Because of the '_generated_' in the filename, I haven't created a patch.
| 
| If the above is right, do you think adding BEGIN_RCPP / END_RCPP pairs
| in all of the CppFunction-derived classes would be acceptable to work
| round this feature of the current build set-up under MinGW?

As Romain said, the issue is known as a Windows headache; we so far had no
fix for it.  

You could test this locally as the scripts generating these files are in the
SVN. Most/all of these are 'one level up' in a directory scripts/ next to the
Rcpp/ directory.  A quick grep reveals that generator_Module_CppFunction.R
may be the one you want to try here (and other may need the same treatment,
to be seen).

You could then build a local source tree and try that, including the
regression tests.  

Hope this helps,  Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list