Re: [Rd] Segmentation faults on SEXP conversion 20)

From: <nabble.30.miller_2555_at_spamgourmet.com>
Date: Sun, 15 Nov 2009 21:38:22 -0500

On Sun, Nov 15, 2009 at 9:16 PM, Duncan Murdoch - murdoch_at_stats.uwo.ca <+nabble+miller_2555+1412c7fca2.murdoch#stats.uwo.ca_at_spamgourmet.com> wrote:
>
> Sorry, I missed something else that's obvious:  .Call needs a return value.
>  The c function needs to include Rinternals.h, and the function needs to
> return a SEXP.  So this works:
>
> #include <Rinternals.h>

> SEXP Rwrite() { Rprintf("[%i] %s",12,"Hi");  return R_NilValue; }
>
> (and your ptest function will return NULL).
>
> Duncan Murdoch

Ah - I must not have read the documentation closely enough to realize a return value was required for external functions using the .Call interface. By not returning anything, I think my erroneous calls were mangling the stack heap. Thanks!

Will



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 16 Nov 2009 - 02:46:18 GMT

This archive was generated by hypermail 2.2.0 : Wed 18 Nov 2009 - 02:40:28 GMT