-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
OPTION_INVOKING_METHOD should be a public field #1394
Comments
What do you try to do? The method is only used to determine the number of fixed arguments, to setup the right native call frame. I'm interest in the use-case. |
This is used for the mapping of |
Thank you - a quick first thought: I think it would be better to rethink this on the JNA side. The core problem is, that the foreign function interface needs the information how many fixed functions parameters are present. This information is currently deduced from the java method signature. However it is perfectly possible to call native functions without a java method present and that should be enough. |
The particular use case I am just looking at is very related to your comment. The objc_msgSend beast takes a vararg parameter and when letting JNA know about this method signature will lead to unexpected crashes on aarch64. This is documented in Don’t Redeclare a Function to Have Variable Parameters at Addressing Architectural Differences in Your macOS Code and was previously discussed in this thread. Thus I can make it work for invocations with no variadic arguments by omitting the Now, invoking
with version 5.9.0, but succeed with the latest master branch with #1383 included when Not sure if this is the appropriate place to discuss this but I thought I should write it down here as this what caused me to report this issue in the first place. |
Ok - it all comes down to the question: What is the real definition of |
Because objc_msgSend must support calls to any method, it accepts a variable list of parameters instead of fixed parameters.
Because of this I assume my workaround works by defining |
See https://www.mikeash.com/pyblog/objc_msgsends-new-prototype.html for a detailed explanation.
The rule of thumb seems to be: You take the method prototype, prepend an Therefore, my conclusion has been such far that |
The field in
Function#OPTION_INVOKING_METHOD
should be public as it is required when using the public methodinvoke
in the same class with the options argument.The text was updated successfully, but these errors were encountered: