title: Returning a C++ class to Java via JNI
body: <p>I'm currently using both C++ and Java in a project and I'd like to be able to send an object which is contained in C++ to my Java interface in order to modify it via a GUI and then send the modification back in C++.</p>
  
  <p>So far I've been returning either nothing, an int or a boolean to Java via the JNI interface. This time I have to send an object through the interface. I have made similar class definition available both in C++ and in Java. <strong>I'd like to know how I'd go about creating the object so that I can use it in Java.</strong></p>
  
  <p>In C++ I have:</p>
  
  <pre><code>JNIEXPORT MyObject JNICALL Java_ca_X_Y_Z_C_1getMyObject(JNIEnv* env, jclass, jint number);
  </code></pre>
  
  <p>This function would get called by Java in order to get the object from the C++ side (the object is contained in a singleton, easily accessible).</p>
  
  <p>On the Java end, I do a simple call to this method,</p>
  
  <pre><code>MyObject anObject = C_getMyObject(3);
  </code></pre>
  
  <p>which should return me the newly created object.</p>
  
  <p>Java currently returns me a UnsatisfiedLinkError when I do the actual call. What is wrong?</p>