title: JNA Callback function as a parameter
body: <p>I am trying to use a native dll from Java using JNA. I am new to both Java and JNA. I am having issues with using callback function as a function parameter to the dll exported method.</p>
  
  <p>Here is how the native function looks,</p>
  
  <pre><code>RegisterCallback(UNUM32 hMod, UNUM32 hCLL, CALLBACKFNC EventCallbackFunction)
  </code></pre>
  
  <p>This method basically tells the DLL to use this java method as a callback whenever there are certain events detected by the DLL.</p>
  
  <p>Here is the callback function prototype,</p>
  
  <pre><code>EventCallbackFunction(UNUM32 eventType, UNUM32 hMod, UNUM32 hCLL, void *pCTag,   void *pTag)
  </code></pre>
  
  <p>Here is the java side implementation,</p>
  
  <pre><code>Library.INSTANCE.RegisterCallback(hMod, hCLL, eventCallbackFunction);
  </code></pre>
  
  <p>The eventCallbackFunction looks like this,</p>
  
  <pre><code>public interface EventCallbackInterface extends Callback {
  
  public void callback(int eventType, int hMod,  int hCll, Pointer clltag, Pointer apiTag);
  </code></pre>
  
  <p>}</p>
  
  <pre><code>    public class Bridge{
  public static EventCallbackInterface eventCallbackFunction = new EventCallbackInterface(){
  
      public void callback(int eventType, int hMod,  int hCll, Pointer clltag, Pointer apiTag) { System.out.println("Into the callback function: ");}
  </code></pre>
  
  <p>}
  }</p>
  
  <p>I do not see any crash but it simply does not work eventhough the DLL recognizes the correct events. Could anybody please help me in this regard ?
  Many thanks in advance !</p>