Background
I am developing an application for android in eclipse and now I have a problem and I need your help. So I must Call function written in C from JAVA application. But on my way of writing code I have some Questions which you can see below. I am waiting for your answers and ideas ...
C Code:
typdef struct blobData_s {
unsigned long length;
unsigned char data[1];
} blobData_t;
unsigned int CheckEnrollmentExist ( unsigned long hdevice, blobData_t* pInputInfo ) {
// Function code goes here
..........................
return some_value;
}
JAVA Code:
In JAVA code instead of unsigned long
I use int
so I can write.
class jblobData_c {
public int langth;
*Question 1.*
}
public class ApplicationMainClass extends Activity {
// Some code goes here
......................
public native int JCheckEnrollmentExist( int jhdevive, *Question 2.* );
}
Question 1.
- What I can use instead of
unsigned char
in JAVA Code ? - What I must write in JAVA code instead of
unsigned char data[1];
?
Question 2.
- How I can use
class jblobData_c
instead ofblobData_t* pInputInfo
in the JAVA Code ? - What I must write in JAVA instead of
blobData_t* pInputInfo
?
JNI Code:
JNIEXPORT jint JNICALL Java_com_Test_JCheckEnrollmentExist(JNIEnv* env, jobject obj, jint jhdevice, *Question 2.* ) {
// Call the base function from C code.
return CheckEnrollmentExist( jhdevice, *Question 3.*);
}
Question 3.
- What I must write in
CheckEnrollmentExist
function that is C Code Function instead ofblobData_t* pInputInfo
in order this function works right and given parameter be the same