[Ecls-list] Embedding ECL (Newbie)

David Creelman dave at geko.net.au
Sun Jan 22 15:42:01 UTC 2006

Hi Geoff,

Embedding in Quake is interesting. Sounds like fun.

A few things.

There are a few inlines there instead of static. I think it should be
static on those ?

my_c_string_to_object is defined, but it's not used anywhere. Maybe that
will show up some errors.

I think nargs should be 3, not 4. It's a count of the args not including
the count itself.

Also, apparently pointing to obj->string.self is not always safe,
because ECL strings are resizable and not guaranteed to be null
terminated. Try using ecl_make_null_terminated_string (from memory ?) or
write a function that wraps the following

strncpy(obj->string.self, dest, obj->string.fillp);

Also, there's a recurring malloc, free in there. Is it possible to
declare it as char lisp_code[200] and not have to worry about the
overhead of malloc/free ? This way lisp_code gets looked after on the
stack. ECL will make a copy of the string, so you'll be okay (works for


On Mon, 2006-01-23 at 12:03 +1300, Geoff Cant wrote:
> Hi there, I'm new to embedding ECL into things and am having trouble
> with ecl and Quake 1.
> I'm trying to embed ecl into the QuakeWorld client. I've got as far as
> booting CL and converting strings to cl_objects and back again via
> format, but can't figure out how to actually get eval/funcall to work
> properly. At the moment, they crash the application with tens of
> thousands of recursive calls to:
> cl_error
> cl_funcall
> L36error_type_specifier
> L3Universal_Error_Handler
> L30coerce_to_condition
> cl_typep
> The console logs show:
> Read or write operation to stream #<input stream "stdin"> signaled an  
> error.
> Explanation: Resource temporarily unavailable.
> QUAKE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
>  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
>  >>>>>>>>>>>>>>>>>>
> My lisp and c code (cribbed from the xchat plugin and vbecl) are
> attached.
>  In the code I'm trying to use Cmd_Lisp_Eval with a lisp_code string of "(+ 1 1)". The crash happens in cl_lisp.c at line 73 ("cl_object result = cl_safe_eval (form, Cnil, NULL);"). Does my eval code look reasonable (like it's doing the right things)? As quake is a GUI app without a useful stdin/out, what do I need to do in ECL to prevent errors due to things trying to read *standard-input* and friends? What am I missing in the way of housekeeping (memory management, static roots for the GC, ...)? Thanks muchly, -- Geoff Cant
David Creelman
GPG: 11CC 0D54 D37A 4B9C 5C65  AB63 5B18 7F99 7D77 9CA5

More information about the ecl-devel mailing list