Fantastic, that's the first clear description I've seen! For anyone
else who needs this explaining at the basic level that I have, my code
is as follows:
####### Java class declaration: #######
public class JavaCls {
public boolean res;
}
####### Java native declaration: #######
public native JavaCls trueFalse();
############### C++: ###############
extern "C"{
jobject
Java_astroexplorer_scott_uk_AstroExplorer_trueFalse( JNIEnv* env,
jobject thiz)
{
jclass javaCls = env->FindClass("astroexplorer/scott/uk/JavaCls");
jmethodID cid = env->GetMethodID(javaCls,"<init>","()V");
jobject out = env->NewObject(javaCls, cid);
jfieldID fid = env->GetFieldID(javaCls , "res", "Z");
env->SetBooleanField( out, fid, true);
return out;
}
}
###### To get the native results: ######
JavaCls result = trueFalse();
Now I just need to add the code to check for null values being
returned which would inevitably cause the program to hang. Thank you,
thank you, thank you!