[Rd] Segmentation faults on SEXP conversion 20)

nabble.30.miller_2555 at spamgourmet.com nabble.30.miller_2555 at spamgourmet.com
Mon Nov 16 03:38:22 CET 2009


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



More information about the R-devel mailing list