As others as commented, everything going in/out of the .Call() interface
needs to be SEXP (even if it does nothing and you are returning
R_NilValue).
Secondly, your attached code is both (1) too long, and (2) incomplete.
You should write some *simple* R code that
uses only soamInit() and soamUnIn
See at bottom for an example.
On Wed, 2007-07-25 at 11:26 -0700, Jonathan Zhou wrote:
> Hi Hin-Tak,
>
> Here is the R code function in where I called the two C++ and further below
> are the 2 C++ functions I used to create the externalptr and use it :
>
> soam.Rapply <- function (x, func, ...,
>
Hi Hin-Tak,
Here is the R code function in where I called the two C++ and further below
are the 2 C++ functions I used to create the externalptr and use it :
soam.Rapply <- function (x, func, ...,
join.method=cbind,
njobs,
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,
Hi all,
Here is the R code function in where I called the two C++ and further below
are the 2 C++ functions I used to create the externalptr and use it :
soam.Rapply <- function (x, func, ...,
join.method=cbind,
njobs,
As other has commented, without the rest/full of your code it is
difficult to tell... I have a few suggestions though:
- it is obviously a memory-related issue. An external pointer is partly
allocated by R and partly allocated by you - you need to check both
parts, and their individual usages.
Jonathan Zhou <[EMAIL PROTECTED]> writes:
> Hi all,
>
> I've been writing a package and I've run into a problem that I'm unsure how
> to solve. I am looking to pass a C++ class object to R so that it may be
> passed back to another C++ function later on to be used. I'm quite new to R
> and this
Jon,
I suspect that you're leaving out some important details - please
include your R code for inspection as the C++ code below seems ok
(although you may want to show us the declarations as well). Also you
may want to look into this with a debugger in case the segfault is
actually in your
Hi all,
I've been writing a package and I've run into a problem that I'm unsure how
to solve. I am looking to pass a C++ class object to R so that it may be
passed back to another C++ function later on to be used. I'm quite new to R
and this is my first time writing a package, so I hope you ca