Android Ndk calling native c++ code always jni?
<p>I am using android studio, and followed the basic tutorials with android ndk. I also get the simple projects working.</p>

<p>Question: </p>

<p>My native lib returns a simple string. The file MyLibrary.cpp is within the jni folder, its working and looks like this:</p>

<pre><code>#include "de_rownage_ndklib_MyNDK.h"

JNIEXPORT jstring JNICALL Java_de_rownage_ndklib_MyNDK_getMyString  (JNIEnv *env, jobject)
{
   return(*env).NewStringUTF("My Lib");
}
</code></pre>

<p>Now I would like to use a class like here: <a href="https://stackoverflow.com/questions/22852672/scanning-and-editing-android-app-memory-values-programmatically">Scanning and Editing Android App Memory Values Programmatically</a>, do I have to put it in a JNIEXPORT jint wrapper? This would not make sense to me. The JNI seems to be a an interface for calling c++ code in Java. It seems like i can not create a new memory.cpp file and call it in java without the JNIEXPORT stuff?</p>

<p>I ve also seen sth like this:</p>

<p>JNI (Directory) -> NDK_MyFunc.c</p>

<p>In the Memory.java (Activity-Class)</p>

<pre><code>public String execNDK(String params) {
    String[] commands = new String[2];
    commands[0] = "chmod 777 /data/data/com.android.test/NDK_MyFunc";
    commands[1] = "/data/data/com.android.test/NDK_MyFunc " + params;
    return shell.execute(commands, false);
}
</code></pre>

<p>How is this working? Is it working? Does the file get compiled on the android system and executed? What I am trying to do is executing the main() function above, within my android app.</p>