JAVA_CODE:
public class Employee {
private int age;
private String name;
public Employee(int age, String name) {
this.age = age;
this.setName(name);
}
public int getAge() {
return this.age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
Run Code Online (Sandbox Code Playgroud)
C结构:
typedef struct Employee_s {
int age;
char name[200];
}Employee_t;
Run Code Online (Sandbox Code Playgroud)
JNI代码看:
jint
Java_com_example_cloudonlibtest_CloudOnLibTestActivity_second( JNIEnv* env,
jobject this, jobject employeeObject)
{
Employee_t em;
em.age =418;
strcpy(em.name, …Run Code Online (Sandbox Code Playgroud)