-
Notifications
You must be signed in to change notification settings - Fork 41
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
variadic function calls on macos arm64 do not work #94
Comments
Hi! CFFI itself does not contain any assembly code for all the platforms it supports, and instead delegates to LibFFI. I think that this kind of problem can come from one of three places:
Can you paste the whole runnable code for your example? |
I personally don't have a Mac and have to use one of a colleague. I'll try to produce some example tomorrow that really fails on the OS. I just want to note that I am using |
Actually, variadic function calls still need to go through LibFFI, even with |
I see. Now that you point it out, this makes sense. Maybe I should also get rid of the variadic function. All arguments (except one int) are pointers anyway and could as well be passed in an array. I'll still report the example here so that you can identify the problem. |
I managed to reproduce the issue on the macos runner. Strangely, this only happens with conda:
Here is the list of packages installed in the conda environment:
|
The culprit might actually be the rather old libffi version on conda-forge from 2021... I further refined the workflow and the test only fails if the libffi from conda-forge is used: We should probably request an update libffi here: |
The calling conventions on MacOSX for x86_64 and arm64 differ for variadic functions.
I have a function
Accessing the third parameter fails because it is probably passed on the stack by cffi instead of by register.
As a test, I managed to circumvent the problem by adding more named parameters to enforce passing the variadic parameters on the stack.
The text was updated successfully, but these errors were encountered: