-
Notifications
You must be signed in to change notification settings - Fork 134
Compatibility with Allegro v.11 #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sure, we'll need someone who can write a fixed implementation conditionalized on ACL version, and then then run all the tests for both old and new ACL. (Won't be me, since I'm not an ACL user; does Franz have any sort of user forum where this issue might have already been raised or where we can ask for a list of FFI-related changes that would speed things up on CFFI side?) |
Thank you, I have not found a user forum and believe Franz handles all matters directly with individual customers. https://franz.com/support/documentation/11.0/foreign-functions.html#30-the-foreign-function-interface-specification I can try requesting anything useful that isn't covered in the documentation, please let me know. I'll provide whatever support I can. |
Sure, please try linking them to this issue. |
I sent a follow-up e-mail to this issue that Franz helped me identify but haven't received a response yet. I'm wondering if there's any ACL user here who can help me with this problem. I suppose there isn't any great demand at this time but I would offer what compensation I can. |
Yes, I am an ACL user who just ran into the same problem. I hadn't yet figured out the new symbol though, so thanks. I don't have an old version to run the tests on, but I can write a fix conditionalized on ACL version, and then then run all the tests for new ACL. |
Well, I can help you, but not do the heavy lifting for the update. Change these two functions in src/cffi-allegro.lisp
and
The only changes are the conditionalized change to system::ff-funcall. This works for me, but the reason I'm not making a pull request is that it fails a bunch of tests that I don't have time to track down (see below). This seems to work for me.
These look mostly like warnings, but I don't have time to track down 54 failed tests when it seems to work for me. Hope this helps! |
@LEHunter Bless you, this fix works on my end too. |
@LEHunter can you evaluate |
cl-user> (ql:quickload :cffi)
To load "cffi":
Load 1 ASDF system:
cffi
; Loading "cffi"
(:cffi)
cl-user> (cffi:foreign-funcall "toupper" :char (char-code #\a) :char)
65
cl-user>
… On May 6, 2024, at 5:03 AM, Luís Oliveira ***@***.***> wrote:
@LEHunter <https://github.com/LEHunter> can you evaluate (cffi:foreign-funcall "toupper" :char (char-code #\a) :char)? (that's the body of the first failing test FUNCALL.CHAR). My guess is that system::ff_funcall has extra return values.
—
Reply to this email directly, view it on GitHub <#381 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AACWZKJB6TJOYCBGX7T6P3LZA6LVHAVCNFSM6AAAAABF2RBQWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWGI2DSOJVGI>.
You are receiving this because you were mentioned.
|
For what it's worth, the failing tests above are what I get in ACL 11 without the conditionalized
|
After a little more testing, it seems some of these fail in ACL 10.1 too. Here are the tests that fail on ACL11 but not on ACL10.1:
|
Is there a reason why Section 3.1.1 of the documentation makes a distinction between
|
@digikar99 I believe that ff:foreign-pointer didn't exist when CFFI's Allegro backend was written. |
Uhm, okay, I can trace the decision to use integers as foreign pointers on Allegro CL to the very start of Allegro CL support. I also see that @luismbo experimented with ff:foreign-pointer even back then but decided to go with integers. I'm curious at this decision! Later on, |
It was a long time ago, but ISTR that it was the natural decision given that the SBCL backend also used SAPs rather than the higher level alien pointers and The main goal was to avoid consing, I suppose. I agree that a better typed representation would be better, in general. |
Understood! I
8000
n that case, I will issue a PR if I get down to rewriting this part using |
I'm not convinced switching to a CLOS representation for pointers is a good idea. Won't that introduce unnecessary consing and overhead? |
Okay, just checked. Indeed, while SBCL has
I agree. Alright, plan to rewrite using |
Though, given this from the documentation,
Do we want to make |
We could argue for supporting multiple pointer representations (maybe that could enable easier interoperability between CFFI and other code using ACL's FFI) but some bits of CFFI-SYS clearly only work with the integer representation so the type is not accurate. |
I use Common Lisp library lispbuilder-sdl which relies on CFFI.
My lisp implementation Allegro CL has updated to version 11 and their internal symbol FF-FUNCALL has changed to FF_FUNCALL. (Not certain, but I think this is because it can now be used in the browser.)
For reference, here is the lispbuilder-sdl code which calls FF-FUNCALL.
cffi/src/cffi-allegro.lisp
Line 260 in 621cb9d
I am a bit out of my depth in this topic, but would it be possible to update CFFI so the new symbol FF_FUNCALL is used?
The text was updated successfully, but these errors were encountered: