<div dir="ltr"><div><div>Hi Dirk , thanks for your reply. <br><br><br></div>When i run the sample 7 as a standalone program, (I mean executing ./rinside_sample7 ) , the assignment to C++ double works fine  <b>double d1 = Rcpp::as< double >(R.parseEval(txt));</b> and I get the desired output.<br><br></div>But when I run the same set of commands <br>       <i> txt = "m <- 1.23";<br>        double d1 = Rcpp::as< double >(R.parseEval(txt));<br>        std::cout << "d1 " << d1 << std::endl;</i><br><br><div><br><br><div>in my codebase , the execution gets stuck at the call of  <b>"<i>double d1 = Rcpp::as< double >(R.parseEval(txt));"<br><br></i></b></div><div><i>when i look further into this, this is the backtrace that I get <br><b><br></b>"<br>(gdb) n<br>345        <b>std::string txt = "m <- 1.23;";</b><br>(gdb) n<br>349            <b>double d1 = Rcpp::as< double >(R.parseEval(txt));</b><br>(gdb) s<br>0x0000003a088e8770 in profil_counter () from /lib64/libc.so.6<br>(gdb) s<br>Single stepping until exit from function profil_counter,<br>which has no line number information.<br>RInside::parseEval (this=0x7fffffffdb20, line="m <- 1.23;") at RInside.cpp:379<br>379    RInside.cpp: No such file or directory.<br>    in RInside.cpp<br>(gdb) s<br>381    in RInside.cpp<br>(gdb) s<br>379    in RInside.cpp<br>(gdb) s<br>381    in RInside.cpp<br>(gdb) s<br>0x0000003a088e8770 in profil_counter () from /lib64/libc.so.6<br>(gdb) n<br>Single stepping until exit from function profil_counter,<br>which has no line number information.<br>0x0000003a08009d40 in _dl_lookup_symbol_x () from /lib64/ld-linux-x86-64.so.2<br>(gdb) n<br><b>Single stepping until exit from function _dl_lookup_symbol_x,<br>which has no line number information.<br><br>Program received signal SIGTRAP, Trace/breakpoint trap.<br>0x0000003a08009342 in do_lookup_x () from /lib64/ld-linux-x86-64.so.2</b><br>"<br><br></i></div><div><i>Thanks<br>Amit<br></i></div><div><i><br></i></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 11, 2014 at 5:50 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On 11 December 2014 at 12:02, Amit Gupta wrote:<br>
| Hi all,<br>
|<br>
| Can anyone please help me in this.<br>
<br>
</span>[...]<br>
<span class=""><br>
|     When I replace the above code with<br>
|<br>
|     std::string txt = "m <- c(1,2,3,4,5);"<br>
|                   "print(mean(m));";<br>
|                    R.parseEval(txt);<br>
|<br>
|     This code works perfectly printing the mean of the vector.<br>
|<br>
|     My guess is that the problem is coming somewhere in typecasting the output<br>
|     of R.parseEval to double etc.<br>
|<br>
|     Can someone please look into this. Thanks<br>
<br>
</span>A quick glance into examples/standard/*.cpp reveals that files<br>
<br>
  sample7.cpp<br>
  sample10.cpp<br>
<br>
both assign to a double.  What happens if you run those?<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
<br>
--<br>
<a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
</font></span></blockquote></div><br></div>