title: JNI Calls different in C vs C++?
body: <p>So i have the following code in C that utilizes Java Native Interface however i would like to convert this to C++ but am not sure how.</p>
  
  <pre><code> #include &lt;jni.h&gt;
   #include &lt;stdio.h&gt;
   #include "InstanceMethodCall.h"
  
   JNIEXPORT void JNICALL 
   Java_InstanceMethodCall_nativeMethod(JNIEnv *env, jobject obj)
   {
       jclass cls = (*env)-&gt;GetObjectClass(env, obj);
       jmethodID mid = (*env)-&gt;GetMethodID(env, cls, "callback", "()V");
       if (mid == NULL) {
           return; /* method not found */
       }
       printf("In C\n");
       (*env)-&gt;CallVoidMethod(env, obj, mid);
   }
  </code></pre>
  
  <p>Java Program:</p>
  
  <pre><code> class InstanceMethodCall {
       private native void nativeMethod();
       private void callback() {
           System.out.println("In Java");
       }
       public static void main(String args[]) {
           InstanceMethodCall c = new InstanceMethodCall();
           c.nativeMethod();
       }
       static {
           System.loadLibrary("InstanceMethodCall");
       }
   }
  </code></pre>
  
  <p>What are the differences in which JNI interacts with C and C++? Any help is greatly appreciated.</p>
  
  <p>Thanks, Pete</p>