Safely calling lisp lambda function from C?
bruce li
leilmyxwz at gmail.com
Tue Sep 8 16:15:06 UTC 2015
Hi,
I'm writing a wrapper for a game engine that involves a few callbacks.
I wrap the callback in a C function so that I can pass in lambdas as
callbacks. Here is how the code looks like:
cl_object callback_wrapper(cl_object lambda, cl_object ...) {
cl_funcall(2, lambda, some_params);
}
It works OK if the passed in lambda function is syntactically correct.
But it fails disastrously if the function contains errors, either
syntactically or logically and it crashes the program. I wonder if
it's possible to call the lambda function in a safer manner and when
anything is wrong, it just drops to the top-level?
A second question is... can I traverse lisp lists in C? I would like
to collect everything into a C++ vector and pass that on to the
engine's API.
Thanks,
Bruce
More information about the ecl-devel
mailing list