[Rd] Using R_MakeExternalPtr

Simon Urbanek simon.urbanek at r-project.org
Wed Jul 25 20:12:57 CEST 2007


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
>
>



More information about the R-devel mailing list