-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix GH-9090: Support assigning function pointers in FFI #9107
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
Conversation
Looks fine by me but cc @dstogov |
Thank you! On a quick glimpse, this looks good to me as well, but we should also check the calling convention compatibility ( |
} | ||
|
||
/* Ensure same arg count */ | ||
dst_argc = dst_type->func.args ? zend_hash_num_elements(dst_type->func.args) : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need a check for C varags? Either way, a test for that would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, added a variadic to the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check
(src_type->attr & ZEND_FFI_ATTR_VARIADIC) == (dst_type->attr & ZEND_FFI_ATTR_VARIADIC)
Also it's make sense to add check for calling convention
src_type->func.abi == dst_type->func.abi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added those checks. Thank you.
105ce4b
to
44c3558
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else except abi
and variadic
looks fine.
} | ||
|
||
/* Ensure same arg count */ | ||
dst_argc = dst_type->func.args ? zend_hash_num_elements(dst_type->func.args) : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check
(src_type->attr & ZEND_FFI_ATTR_VARIADIC) == (dst_type->attr & ZEND_FFI_ATTR_VARIADIC)
Also it's make sense to add check for calling convention
src_type->func.abi == dst_type->func.abi
44c3558
to
3f70649
Compare
Thank you! |
No description provided.