Skip to content

Instantly share code, notes, and snippets.

@initishbhatt
Last active April 12, 2018 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save initishbhatt/5df9aa1f71d23fc6efb6c86a056e7618 to your computer and use it in GitHub Desktop.
Save initishbhatt/5df9aa1f71d23fc6efb6c86a056e7618 to your computer and use it in GitHub Desktop.
native function
#include <jni.h>
#include <string>
extern "C" JNIEXPORT jstring
JNICALL
Java_com_initishbhatt_kotilnjnisample_NativeStore_stringFromJNI(
JNIEnv *env,
jobject /* this */) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment