Callback on a CLang code block?

Open
#571 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
java, macos, objective-c
Domain
desktop

Research direction

Start by reading JNA's Callback support and comparing it with the xpc_connection_set_event_handler signature and Objective-C block types shown in the issue. Determine whether the requested callback form can be supported and identify a minimal test or documented limitation; done means the behavior is demonstrated or the limitation is clearly recorded.

Written by the indexing model from the issue text.

Description

feature request

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:

typedef void (*xpc_connection_handler_t)(xpc_connection_t connection);

typedef void (^xpc_handler_t)(xpc_object_t object);

void xpc_connection_set_event_handler(xpc_connection_t connection, xpc_handler_t handler); 

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

Dominant language
Java
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from java-native-access/jna

All issues in java-native-access/jna

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.