Trivial as the question sounds, but after some time looking through the ECL documentation, CFFI documentation and resorting to google, I still could not arrive to a definitive answer. ECL docs mention nothing of a callback syntax, CFFI docs do not mention any implementation restrictions in regards to callbacks in ECL, and I can not cast the pages that google hints at to logical.
Asked
Active
Viewed 450 times
1 Answers
6
ECL does support callbacks both in interpreted and compiled mode. CFFI takes care of everything for you, which is why there is no specific mention of ECL (why should there be?). If you care about the actual implementation look at ecl/src/lsp/ffi.lsp. The signature for FFI:DEFCALLBACK is (defmacro defcallback (name ret-type ((arg-name arg-type)*) &body body) In other words, it takes more or less the same arguments as DEF-FUNCTION (type syntax is the same, UFFI) but it explicitely names each of the arguments (arg-name) and provide code in lisp to be executed.

Juanjo
- 659
- 3
- 9
-
It is encouraging to get a responce from the developer :) I did not mention, but when evaluating CFFI:DEFCALLBACK I was getting an error "CDECL does no denote a valid calling convention." So I started checking if callbacks are possible in general. Must be some local problem with my installation or program then, will try to figure out. Thanks. – Andrei Mar 05 '12 at 21:10
-
Ups, you might be right. The problem is that we are using the libffi library and as such there is no CDECL convention (names change from platform to platform). It would help me to solve this problem if you reported it through the ECL bug tracker. Will solve ASAP. – Juanjo Mar 27 '12 at 17:27
-
I've submitted a bug report: https://sourceforge.net/tracker/?func=detail&aid=3514934&group_id=30035&atid=398053 – Andrei Apr 04 '12 at 17:33