Unfortunately, to enjoy the benefit of that, I need to redirect the terminal io, which I am also having trouble with. Based on the example of eclgui, I am attempting it this way:

cl_def_c_function(cl_intern(1, make_simple_base_string("%TERM-IO-WRITE-CHAR%"")), (void *)termIOWriteChar, 1);
cl_def_c_function(cl_intern(1, make_simple_base_string("%TERM-IO-FLUSH%")), (void *)termIOFlush, 0);

(The following is executed with si_safe_eval - I omit my wrapper for clarity, and show you the output in the repl I have in my app)

(defclass %term-io% (gray:fundamental-character-output-stream) (last-char))

(defmethod gray:stream-write-char ((stream %term-io%) c) ( %TERM-IO-WRITE-CHAR% c))


(defmethod gray:stream-force-output ((stream %term-io%)) ( %TERM-IO-FLUSH% ) t)


(setq *terminal-io* (make-two-way-stream (make-string-input-stream \"\") (make-instance '%term-io%)))

#<two-way stream 0a04b320>

(setq *error-output* (two-way-stream-output-stream *terminal-io*))

#<a %TERM-IO%>

I'm expecting the function termIOWriteChar and termIOFlush to be called - they are not.

On Mon, Jul 13, 2009 at 6:04 PM, Juan Jose Garcia-Ripoll <juanjose.garciaripoll@googlemail.com> wrote:
On Mon, Jul 13, 2009 at 6:07 AM, Greg Santucci<thecodewitch@gmail.com> wrote:
> I have embedded ECL into my C++ simulation, and I'd like to be able to call
> "load" from the si_safe_eval function.
> When I try the following, the error symbol is returned:
> cl_object form = c_string_to_object("(load \"test.lsp\"");
> cl_object result = si_safe_eval(3, form, Cnil, g_evalErrorSymbol);

Be creative

cl_object form = c_string_to_object("
(handler-case (load \"test.lsp\")
  (error (c) (princ c) (print c)))

or if you want to debug it

cl_object form = c_string_to_object("
(handler-case (load \"test.lsp\")
  (error (c) (invoke-debugger c)))

Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)