I know this is a JAVA thing but Im having issues with the C portion of the code. I know there isnt a jStringarray type of or anything but I was trying to get an array of strings to pass into the C code for a simple example does anyone have any ideas
Code:
#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
JNIEXPORT void JNICALL
Java_HelloWorld_print
(JNIEnv *env, jobject obj, jstring javaString, jcharArray arr)
{
jchar* buf;
jint i =0;
const char *nativeString = (*env)->GetStringUTFChars(env, javaString, 0);
printf("%s\n", nativeString);
buf = (*env)->GetCharArrayElements(env, arr, NULL);
if (buf == NULL) {
return 0; /* exception occurred */
}
for(i =0; i < 5; i++){
printf("%s\n",buf[i]);
}
printf("Hello World!\n");
(*env)->ReleaseStringUTFChars(env, javaString, nativeString);
(*env)->ReleaseCharArrayElements(env, arr, buf, 0);
return;
}