<div class="gmail_quote">On Tue, Jun 1, 2010 at 2:23 PM, Erik Winkels <span dir="ltr"><<a href="mailto:aerique@xs4all.nl">aerique@xs4all.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

I'm starting a REPL by doing this in C++:<br>
<br>
    cl_object obj = ecl_read_from_cstring("si:top-level");<br>
    cl_funcall(1, obj);<br>
<br>
Now when calling functions that have been created with ecl_def_c_function<br>
I almost never get the return value back at the REPL, but they are set<br>
when I call the same function with setf or defparameter.  Like so:<br><br>
    OGRE[1]> (get-actual-height *viewport*)<br></blockquote><div><br></div><div>This toplevel does not seem to be the standard toplevel, for you have a different prompt, to begin with. Then, you are not showing the code of the functions you define and how they return multiple values. Most likely you are just using a "return only-value" statement and do not set the counter for the returned values, which is needed by ECL to know the number of returned values. If you look at toplevel.c, the compiled version of the toplevel you will see</div>

<div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">  </span>cl_env_copy->values[0]=si_eval_with_env(2,ecl_symbol_value(ECL_SYM("-",15)),ecl_symbol_value(VV[2])) /*  EVAL-WITH-ENV */;</div>

<div><span class="Apple-tab-span" style="white-space:pre">      </span>ecl_stack_frame_push_values(V1);cl_env_copy->values[0]=ecl_apply_from_stack_frame(V1,ECL_SYM("LIST",479));</div><div><br></div><div>this evaluates the form stored in the variable '-, saving the first value in the multiple values register and then copying the rest of values.</div>

<div><br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
It would make REPL life a little easier if all of them returned values<br>
at the REPL.  Any ideas?</blockquote><div><br></div><div>More information. An ordinary REPL works just fine as shown in daily life. Obviously there is some problem with either the functions you define (not because of the way you defined them), or in the interface to those functions.</div>

</div><br clear="all">Juanjo<br>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://tream.dreamhosters.com">http://tream.dreamhosters.com</a><br>