Hi Dirk , thanks for your reply.
When i run the sample 7 as a standalone program, (I mean executing ./rinside_sample7 ) , the assignment to C++ double works fine *double d1 = Rcpp::as< double >(R.parseEval(txt));* and I get the desired output. But when I run the same set of commands * txt = "m <- 1.23"; double d1 = Rcpp::as< double >(R.parseEval(txt)); std::cout << "d1 " << d1 << std::endl;* in my codebase , the execution gets stuck at the call of *"double d1 = Rcpp::as< double >(R.parseEval(txt));"* *when i look further into this, this is the backtrace that I get "(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) s381 in RInside.cpp(gdb) s379 in RInside.cpp(gdb) s381 in RInside.cpp(gdb) s0x0000003a088e8770 in profil_counter () from /lib64/libc.so.6(gdb) nSingle stepping until exit from function profil_counter,which has no line number information.0x0000003a08009d40 in _dl_lookup_symbol_x () from /lib64/ld-linux-x86-64.so.2(gdb) nSingle stepping until exit from function _dl_lookup_symbol_x,which has no line number information.Program received signal SIGTRAP, Trace/breakpoint trap.0x0000003a08009342 in do_lookup_x () from /lib64/ld-linux-x86-64.so.2"* *ThanksAmit* On Thu, Dec 11, 2014 at 5:50 PM, Dirk Eddelbuettel <e...@debian.org> wrote: > > On 11 December 2014 at 12:02, Amit Gupta wrote: > | Hi all, > | > | Can anyone please help me in this. > > [...] > > | 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 > > A quick glance into examples/standard/*.cpp reveals that files > > sample7.cpp > sample10.cpp > > both assign to a double. What happens if you run those? > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org >
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel