I have a dynamic link library (DLL) written in c++. In my DLL I have a function like this:
void set_event_callback(EVENT_CALLBACK callback_fcn);
where EVENT_CALLBACK is a function pointer like this:
void (*EVENT_CALLBACK)(int event_type, byte param1, int param2);
I use my DLL in other languages. For example, in C# I call set_event_callback like this:
public delegate void EVENT_CALLBACK(int event_type, byte param1, int param2);
EVENT_CALLBACK HandleEventsDelegate = null;
HandleEventsDelegate = new EVENT_CALLBACK(HandleEvents);
set_event_callback(HandleEventsDelegate);
where HandleEvents is a function like this:
protected void HandleANPREvents(int event_type, byte param1, int param2){ ... }
Now, I want to use my DLL in Java. I'm using JNA to call native code in my java project. I couldn't find function pointers in Java.
How can I call set_event_callback in Java and pass a function to my DLL?