Hey,
I am new to Rust and now am trying to use JNI to call a Rust function that passes and returns a struct. A struct may define like this:
struct stud
{
long int num;
float score;
};
But since there is no struct in Java or JNI parameter conversion. I was thinking to create a corresponding class in Java. But don't know how to implement it.
I have googled this problem, there are very few references and just mentioned maybe I can use jlong. I am still very confused and don't know how to implement it.
Could anyone enlighten me or is there any reference or tutorial regarding this?
public final class Strud {
/*package*/ long mNativeObj;
private Strud() {}
public final long num() {
long ret = do_num(mNativeObj);
return ret;
}
private static native long do_num(long self);