[Rcpp-commits] r2038 - pkg/Rcpp/inst/skeleton

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 18 10:04:52 CEST 2010


Author: romain
Date: 2010-08-18 10:04:51 +0200 (Wed, 18 Aug 2010)
New Revision: 2038

Modified:
   pkg/Rcpp/inst/skeleton/rcpp_hello_world.h
Log:
added comment about RcppExport in the skeleton generated header

Modified: pkg/Rcpp/inst/skeleton/rcpp_hello_world.h
===================================================================
--- pkg/Rcpp/inst/skeleton/rcpp_hello_world.h	2010-08-17 10:29:47 UTC (rev 2037)
+++ pkg/Rcpp/inst/skeleton/rcpp_hello_world.h	2010-08-18 08:04:51 UTC (rev 2038)
@@ -3,6 +3,17 @@
 
 #include <Rcpp.h>
 
+/*
+ * note : RcppExport is an alias to `extern "C"` defined by Rcpp.
+ *
+ * It gives C calling convention to the rcpp_hello_world function so that 
+ * it can be called from .Call in R. Otherwise, the C++ compiler mangles the 
+ * name of the function and .Call can't find it.
+ *
+ * It is only useful to use RcppExport when the function is intended to be called
+ * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672
+ * on Rcpp-devel for a misuse of RcppExport
+ */
 RcppExport SEXP rcpp_hello_world() ;
 
 #endif



More information about the Rcpp-commits mailing list