<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:12pt"><div>[...]</div><div><br></div><div>&gt; You were very, very close to this existing example from the unit test file</div><div>&gt; runit.Vector.R (which, as Lists are GenericVector objects, also contains</div><div>&gt; lists):</div><div>&gt;&nbsp;</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ,"list_push_back"=list(</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; signature(x = "list"),</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'List list(x) ;</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list.push_back( 10 ) ;</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list.push_back( "bar", "foo" ) ;</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return list ;</div><div>&gt; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ')</div><div>&gt;&nbsp;</div><div>&gt; So with that it works if I write your example like this:</div><div>&gt;&nbsp;</div><div>&gt; -----------------------------------------------------------------------------</div><div>&gt; library(inline)</div><div>&gt;&nbsp;</div><div>&gt; code &lt;- '</div><div>&gt; &nbsp; &nbsp; Rcpp::List myList(rList);</div><div>&gt; &nbsp; &nbsp; myList.push_back(10);</div><div>&gt; &nbsp; &nbsp; myList.push_back("foo", "bar");</div><div>&gt; &nbsp; &nbsp; return myList;</div><div>&gt; '</div><div>&gt;&nbsp;</div><div>&gt; lfun &lt;- cxxfunction(signature(rList = "list"),</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body &nbsp; &nbsp;= code,</div><div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plugin &nbsp;= "Rcpp")</div><div>&gt;
 -----------------------------------------------------------------------------</div><div>&gt;&nbsp;</div><div>&gt; as can be seen below.</div><div>&gt;&nbsp;</div><div>&gt; Do not underestimate the usefulness of 750+ regression tests in 330+</div><div>&gt; functions that are run with every release. &nbsp;They do provide examples, even if</div><div>&gt; they are a little hard to read at first :)</div><div>&gt;&nbsp;</div><div>&gt; Also, if an example does not compile, comment-out and simplify til it</div><div>&gt; does. The templated code is finicky. I often split very complex expression</div><div>&gt; into components as there is no shame in using temporary variables....</div><div><br></div><div>Great! &nbsp;Thanks, Dirk. &nbsp;I HAVE looked at the runit stuff before but didn't</div><div>think to do so in this case.</div><div><br></div><div>-- Mike</div><div style="font-size: 12pt; "><br></div></div></body></html>