title: JNI callback passed to C
body: <p>I have a java callback function I want to pass to a C++ wrapper that will in turn pass it to a C/C++ function.</p>
  
  <p>How would I do this?</p>
  
  <p>I imagine the wrapper has to create some type of C++ lambda function or something along those lines to resolve the parameters.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Here are the callbacks signature in C. I will be implementing these in java. (atleast some of them)</p>
  
  <pre><code>typedef struct ASIOCallbacks
  {
      void (*bufferSwitch) (long doubleBufferIndex, ASIOBool 
      void (*sampleRateDidChange) (ASIOSampleRate sRate);
      long (*asioMessage) (long selector, long value, void* message, double* opt);
      ASIOTime* (*bufferSwitchTimeInfo) (ASIOTime* params, long doubleBufferIndex, ASIOBool directProcess);
  } ASIOCallbacks;
  </code></pre>
  
  <p>BTW: ASIOTime *params will never be used.
  I setup the callbacks in a C function. Here's the path...</p>
  
  <p>Java passes callbacks to C++ wrapper. C++ wrapper passes them to C function to setup the callbacks.</p>