-
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
Callback on a CLang code block? #571
Comments
JNA doesn’t have any built-in awareness of clang blocks. You might be able to manually construct the required data to pass as an argument, but that would require delving into the runtime specifics of the blocks implementation. JNA will create a stack-based code stub, the address of which is used as a function pointer and which, when run, transfers execution to the associated JNA Callback.
|
Thanks. Well, it seems to me that I need to do some plain JNI code here. Have tried to construct the code-block struct and pass that without any luck. Maybe I'm missing some pieces here and there. BR, |
It would be pretty helpful for JNA to support clang blocks. Creating the struct and code stub is totally possible, here's an example using libffi just like JNA does: https://www.mikeash.com/pyblog/friday-qa-2011-05-06-a-tour-of-mablockclosure.html |
PRs are welcome. |
I would like to fund development of this implementation. Please reach out if interested to make this happen. |
@twall I would like to see this issue reopened to keep it as a label:"feature request". |
Motivation: Let's use the commit sha of quiche for the 0.18.0 release. Modifications: - Change quiche sha - Skip building of apps as its not needed Result: Use sha that represent the latest quiche release
Hi.
I am trying to call a method on OSX that takes a closure (CLang Block) as an argument. The method is
xpc_connection_set_event_handler
and the signature is as follows:Right now I am calling it using a JNA
Callback
but that does not seem to work. Anyone that have done the same or similar calling to a closure (or code block)?BR,
Sten Roger
The text was updated successfully, but these errors were encountered: