Skip to content
Prev 274353 / 398506 Next

pass an element in a list() from R to C

Functions with prototypes of the form
  SEXP myfunc(SEXP, SEXP, ..., SEXP)
must be called via .Call(), not .C().

Also, you declared myfunction as returning
SEXP but returned nothing.  Try ending the
function with
  return R_NilValue;
You should change the default compiler flags
to report all warnings (-Wall if you are using gcc).

And you left off a line or two of C code
that must have been there, or you code would
have compiled due to errors
  #include <R.h> /* not needed if Rinternals is included */
  #include <Rinternals.h>

Study 'Writing R Extensions' and work through the
examples in it.  In particular, look at section 5.9.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com