Re: [Rd] Using R_MakeExternalPtr

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Wed, 25 Jul 2007 14:12:57 -0400

On Jul 25, 2007, at 12:53 PM, Jonathan Zhou wrote:

> [snip]
> extern "C"
> {
> void soamSubmit (SEXP jobID, //job ID

^^^ - this will definitely crash. All .Call functions must return SEXP, even if it is just R_NilValue;

Cheers,
Simon

> SEXP sesCon, //session pointer
> SEXP caller, //objects
> SEXP pack) //packages
> {
> char* savelist = CHAR(STRING_ELT(caller, 0));
> string strTemp = "";
> int job = INTEGER(jobID)[0];
>
> void* temp = R_ExternalPtrAddr(sesCon);
> Session* sesPtr = reinterpret_cast<Session*>(temp);
>
> // Create a message
> MyMessage inMsg(job, /*pack,*/ savelist);
>
> // Send it
> TaskInputHandlePtr input = sesPtr->sendTaskInput(&inMsg);
> }
> }
> --
> View this message in context: http://www.nabble.com/Using-
> R_MakeExternalPtr-tf4142904.html#a11786494
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 25 Jul 2007 - 18:17:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 Jul 2007 - 20:38:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.