FLI callbacks in LispWorks and best practices
Hi to all and merry Thanksgiving, I am writing a FLI wrapper around a library that uses C callbacks. To avoid reinventing the wheel, I would like to learn about your experience regarding the lisp-side implementation within those callbacks. More specifically here are two questions: 1. The usual idiom for C callbacks is to provide a 'context' or 'userInfo' void pointer so the user of the library can specify the handle to an object at the time an asynchronous function is called. Unfortunately, you can not pass a lisp object because the garbage collector could move this object between the time the function is called, and the callback is received. What is your strategy? Does LispWorks support 'pinned' objects? Are they relevant? 2. During the iterative development phase, the code I write obviously does not work the first time I evaluate it. Code in the callback that yields a Lisp condition can be fatal for the lisp environment. How can I safely handle the condition while still being able to run the debugger? Do you have any suggestion? Thank you in advance for any useful information you may have. Best Regards, Camille