<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">> I will try "gctorture(TRUE)" suggested by Martin.</span><br><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Try running it under valgrind as well.  E.g.,</span></div><div><div style><font face="arial, sans-serif">  % R --debugger=valgrind</font></div><div style><font face="arial, sans-serif">  ==15338== Memcheck, a memory error detector</font></div><div style><font face="arial, sans-serif">  ==15338== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.</font></div><div style><font face="arial, sans-serif">  ==15338== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info</font></div><div style><font face="arial, sans-serif">  ==15338== Command: /opt/sw/R/R-3.1.1.atlas1/lib/R/bin/exec/R</font></div><div style><font face="arial, sans-serif">  ==15338==</font></div><div style><font face="arial, sans-serif">  ==15338== Conditional jump or move depends on uninitialised value(s)</font></div><div style><font face="arial, sans-serif">  ==15338==    at 0x40188B6: index (strchr.S:56)</font></div><div style><font face="arial, sans-serif">  ==15338==    by 0x4007C92: expand_dynamic_string_token (dl-load.c:431)</font></div><div style><font face="arial, sans-serif">  ==15338==    by 0x40085EE: _dl_map_object (dl-load.c:2501)</font></div><div style><font face="arial, sans-serif">  ==15338==    by 0x400188D: map_doit (rtld.c:633)</font></div><div style><font face="arial, sans-serif">  ==15338==    by 0x400F175: _dl_catch_error (dl-error.c:178)</font></div><div style="font-family:arial,sans-serif;font-size:13px">  ...</div></div><div style="font-family:arial,sans-serif;font-size:13px">  > gctorture(TRUE)</div><div style="font-family:arial,sans-serif;font-size:13px">  > # call your test code here</div><div style="font-family:arial,sans-serif;font-size:13px"> <br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Bill Dunlap<br>TIBCO Software<br>wdunlap <a href="http://tibco.com" target="_blank">tibco.com</a></div></div>
<br><div class="gmail_quote">On Tue, Nov 18, 2014 at 10:10 AM, Serguei Sokol <span dir="ltr"><<a href="mailto:serguei.sokol@gmail.com" target="_blank">serguei.sokol@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le 18/11/2014 16:39, Romain François a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Le 18 nov. 2014 à 14:42, Serguei Sokol <<a href="mailto:serguei.sokol@gmail.com" target="_blank">serguei.sokol@gmail.com</a>> a écrit :<br>
<br>
/* call this R command: source("FileName") */<br>
    int errorOccurred;<br>
    SEXP e = lang2(install("source"), mkString("FileName"));<br>
        /* mkChar instead of mkString would lead to this runtime error:<br>
         * Error in source(FileName) : unimplemented type 'char' in 'eval' */<br>
    R_tryEval(e, R_GlobalEnv, &errorOccurred);<br>
</blockquote>
<br>
e is not protected here. Does the problem go away if you protect it:<br>
<br>
SEXP e = PROTECT( lang2(install("source"), mkString("FileName"))) ;<br>
</blockquote>
you mean<br>
SEXP e = PROTECT(lang2(install("source"<u></u>), mkChar("expm.higham.R")));<br>
(because mkString() had no problem)?<br>
No, it does not, the problem is still there.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Or more R/C++ idiomatically, which is both nicer and safer.<br>
<br>
Language e( "source", "FileName" ) ;<br>
</blockquote>
This works as expected. We can suppose that behind the stage<br>
"FileName" is wrap()-ed here with mkString() and not with mkChar().<br>
That's why it's working.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
which suggests that somewhere in Rcpp or RcppArmadillo there is<br>
a mkChar() call instead of mkString().<br>
<br>
Other times, error message can say something like<br>
"argument type[1]='x' must be one of 'M','1','O','I','F' or 'E'"<br>
or "argument type[1]='character' must be a one-letter character string"<br>
This latter message is somewhat volatile per se. The part of message<br>
just after "type[1]=" can be 'character' (as above) or 'method' or 'ANY' etc.<br>
</blockquote>
<br>
That kind of problem usually is related to premature GC.<br>
</blockquote>
I will try "gctorture(TRUE)" suggested by Martin.<br>
<br>
Thanks,<br>
Serguei.<br>
______________________________<u></u>_________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-<u></u>project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/rcpp-devel</a></blockquote></div><br></div>