[Rcpp-devel] RCpp issue (SIGTRAP)

Amit Gupta amit.gupta at alpha-grep.com
Thu Dec 11 07:32:07 CET 2014


Hi all,

Can anyone please help me in this.

Thanks
Amit

On Tue, Dec 9, 2014 at 9:05 PM, Amit Gupta <amit.gupta at alpha-grep.com>
wrote:

> Hi All,
>
> I am trying to integrate R in my C++ code . I was going through some test
> examples in /RInside/inst/examples/standard/. I am able to reproduce the
> results of example 7 on my machine
>
>
> *"txt = "m <- 1.23";        double d1 = Rcpp::as< double
> >(R.parseEval(txt));        std::cout << "d1 " << d1 << std::endl;"*
>
> But when I am trying to integrate into my codebase , I am getting stuck at
> the call of
>
> *Rcpp::as< double >(R.parseEval(txt));*
> To give you the complete details,
>
> this is the code in my codebase(which is getting stuck)
>
>
>
>
>
> *std::string txt = "m <- 1.23;";double d1 = Rcpp::as< double
> >(R.parseEval(txt));std::cout << "d1 " << d1 << std::endl;*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *When I do gdb , follwing is the stack trace(gdb) n341        RInside
> R(0,NULL,true,true,false);(gdb) n345        std::string txt = "m <-
> 1.23;";(gdb) n349            double d1 = Rcpp::as< double
> >(R.parseEval(txt));gdb) s0x0000003a088e8770 in profil_counter () from
> /lib64/libc.so.6(gdb) sSingle stepping until exit from function
> profil_counter,which has no line number information.RInside::parseEval
> (this=0x7fffffffdb20, line="m <- 1.23;") at RInside.cpp:379379
> RInside.cpp: No such file or directory.    in RInside.cpp(gdb) n381    in
> RInside.cpp(gdb) n379    in RInside.cpp(gdb) n381    in RInside.cpp(gdb)
> nProgram received signal SIGTRAP, Trace/breakpoint trap.0x00002aaaab687dfe
> in RInside::parseEval () from
> /usr/local/lib64/R/library/RInside/lib/libRInside.so(gdb) s*
>
>
>
>
>
>
> *When I replace the above code with std::string txt = "m <-
> c(1,2,3,4,5);"              "print(mean(m));";
> R.parseEval(txt);*
>
>
> *This code works perfectly printing the mean of the vector.*
>
>
> *My guess is that the problem is coming somewhere in typecasting the
> output of R.parseEval to double etc.*
>
>
> *Can someone please look into this. Thanks*
>
> *Amit*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141211/b3ebbaba/attachment.html>


More information about the Rcpp-devel mailing list