RE compatibility with Allegro CL's new version 11

12 views
Skip to first unread message

Hugo Clarke

unread,
Mar 31, 2024, 2:02:15 PM3/31/24
to Lispbuilder
Hey guys

Allegro is what I'm comfortable with, and it's worked fine with lispbuilder so far, but I'm hitting an issue since Allegro went browser-based.

The error is an attempt to call 'SYSTEM::FF-FUNCALL' which is an undefined function (an unrecognized foreign function?) and seems to be related to video and audio functions in the body of WITH-INIT.

error1.png
error2.png

It's outside the bounds of what I'm able to understand. I'll do whatever it takes, but I just don't know where to even start.

Best,
Hugo

Luke Crook

unread,
Mar 31, 2024, 10:12:56 PM3/31/24
to lispb...@googlegroups.com
Looks like WITH-INIT is attempting to set up the SDL environment which requires foreign-function calls into the SDL library, which fail. This causes an unwind protect which attempts to close any open audio channels, etc. also calling into the SDL library, also failing.

I can definitely see anything that runs in a browser not supporting foreign-function calls to external libraries. Are there any settings/preferences in Allegro that would enable FFI when in this mode?

/Luke

--
You received this message because you are subscribed to the Google Groups "Lispbuilder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lispbuilder...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lispbuilder/4c60d94a-6503-4317-8a07-ffa5ed968fa4n%40googlegroups.com.

Hugo Clarke

unread,
Apr 5, 2024, 3:44:25 PM4/5/24
to lispb...@googlegroups.com
Thank you for getting back to me Luke,

I've been in contact with Allegro. It turns out it's not a browser issue (it's actually still possible to use the desktop version.) Here's what they told me:
***
"The internal (and thus undocumented and unsupported) symbol 'sys::ff-funcall has changed to 'sys::ff_funcall (note the underscore rather than a dash in the name).

It is dangerous to use unexported and undocumented functionality in Allegro CL, because as you have seen, these functions may disappear or may change in subtle ways. In this case, I think it is the name only that has changed. If you have software that is calling sys::ff-funcall then at the very least you will have to change it to call sys::ff_funcall instead.

If this reference to sys::ff-funcall is within SDL itself then you should contact the vendors of SDL and let them know - unless it is open source and you can make changes, they should change it themselves and provide you with a new library."
***

I understand what the problem is but I don't fully understand FFI and how the linking works. Is this something I can potentially resolve with SDL? It would be great to hear your opinion.

Best,
Hugo

Luke Crook

unread,
Apr 5, 2024, 7:08:52 PM4/5/24
to lispb...@googlegroups.com

We use the CFFI library (https://cffi.common-lisp.dev/) to abstract the foreign function calls across the various Common Lisp implementations - because each implements their FFI interfaces differently. So for example, instead of implementing the glue code in lispbuilder-sdl to call the SDL C function "SDL_Init" one way for Lispworks, and another way for Allegro, and another way for SBCL, we define the foreign function using CFFI ("(cffi:defcfun ("SDL_Init" SDL-Init :void)"), and rely on CFFI calling the correct FFI when running on SBCL, Lispworks, Allegro, etc.


It looks like CFFI calls Allegro using "ff-funcall" and not "ff_funcall". Was this a recent change in the browser-based version of Allegro? The CFFI devs may not be aware of this change.

/Luke



Hugo Clarke

unread,
Apr 8, 2024, 3:22:34 AM4/8/24
to lispb...@googlegroups.com
Got it, thank you as always for the clear explanation! I'll work towards a fix

Hugo

Reply all
Reply to author
Forward
0 new messages