Ok, you have the following problems:

1) If you do not start a toplevel there will not be any active restarts. This is logical: it is your program's responsibility to set them up! So if you want a function to be able to use ABORT then define an evaluating function that sets the restart up.

2) You are using cl_eval(...) which does not set up those restarts. ECL ships with a function, si_safe_eval (ext:safe-eval) which performs evaluation in a safe way, with a handler for errors that returns a default value.

3) It is recommended generally to have a catch-all region around your C code. This sets up a point that protects from unwanted QUIT statements and sets up a point to jump to in case of stack overflows, memory exhaustion, etc See http://ecls.sourceforge.net/new-manual/re37.html

4) Instead of c_string_to_object() you might want to use ecl_read_from_string_safe(s,v) where "v" is the value returned in case of error condition.

The program, in one possible shape

#include <ecl/ecl.h>

#define READCL(expr) (c_string_to_object(# expr))

int main(int argc, char **argv)
       cl_object x;

       cl_boot(1, &argv[0]);

       CL_CATCH_ALL_BEGIN(ecl_process_env()) {

       x = c_string_to_object("(format t \"Hello~%\")");
       x = si_safe_eval(3, x, Cnil, Cnil);

       // Forces program to halt, reading from stdin
       x = c_string_to_object("(vvvvformat t \"Hello~%\")");
       x = si_safe_eval(3, x, Cnil, Cnil);

       } CL_CATCH_ALL_END;


The output is fine (notice lack of error messages!)

(FORMAT T "Hello~%") Hello

(VVVVFORMAT T "Hello~%") 

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