|
|
|
@ -9,7 +9,9 @@ use jni::objects::{JClass, JString};
|
|
|
|
|
// This is just a pointer. We'll be returning it from our function. We
|
|
|
|
|
// can't return one of the objects with lifetime information because the
|
|
|
|
|
// lifetime checker won't let us.
|
|
|
|
|
use jni::sys::jstring; |
|
|
|
|
use jni::sys::{jstring, jint}; |
|
|
|
|
|
|
|
|
|
use std::any::Any; |
|
|
|
|
// This keeps rust from "mangling" the name and making it unique for this
|
|
|
|
|
// crate.
|
|
|
|
|
#[no_mangle] |
|
|
|
@ -34,3 +36,9 @@ pub extern "system" fn Java_HelloWorld_hello(env: JNIEnv,
|
|
|
|
|
// Finally, extract the raw pointer to return.
|
|
|
|
|
output.into_inner() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[no_mangle] |
|
|
|
|
#[allow(non_snake_case)] |
|
|
|
|
pub extern "system" fn Java_MyMath_add(env: JNIEnv, class: JClass, a: jint, b: jint) -> jint { |
|
|
|
|
return a + b; |
|
|
|
|
} |
|
|
|
|