From simon.urbanek at r-project.org  Wed Jul 25 20:12:57 2007
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Wed, 25 Jul 2007 14:12:57 -0400
Subject: [Rd] Using R_MakeExternalPtr
In-Reply-To: <11786494.post@talk.nabble.com>
References: <11785023.post@talk.nabble.com> <11786494.post@talk.nabble.com>
Message-ID: <BC5B0418-63BC-4027-BF19-B271520017AA@r-project.org>


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



[Rd] Using R_MakeExternalPtr
Simon Urbanek