Re: Preliminary libffi progress
- Posted by ghaberek (admin) Oct 01, 2022
- 1140 views
I've added support for callbacks using libffi "closures" API. To test this I added a couple IUP examples along with a modified version of the IUP wrapper I've been working on. You can indicate the argument and return types of a callback in basically the same way you do for a C function, as shown in iup_canvas.ex and iup_editor.ex. (Hypothetically this could also allow for callback procedures if you specify the return type as C_VOID, but I haven't implemented that yet.)
I'm still looking for feedback on the structures aspect of the implementation, because I'm still not in love with define_c_type() as it's written. Eventually I'd like to use libffi as the underlying logic to get memstruct implemented, but I still need a way to tell define_c_func() about memstruct types and vice-versa. What does that even look like?
Edit: Link to repo: https://github.com/ghaberek/libffi-euphoria
-Greg