update at 2022-02-22 20:29:33 by ehlxr
This commit is contained in:
21
mylib/src/lib.rs
Normal file
21
mylib/src/lib.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use jni::objects::{JClass, JString};
|
||||
use jni::sys::jstring;
|
||||
use jni::JNIEnv;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "system" fn Java_me_ehlxr_HelloWorld_hello(
|
||||
env: JNIEnv,
|
||||
_class: JClass,
|
||||
input: JString,
|
||||
) -> jstring {
|
||||
let input: String = env
|
||||
.get_string(input)
|
||||
.expect("Couldn't get java string!")
|
||||
.into();
|
||||
|
||||
let output = env
|
||||
.new_string(format!("Hello, {}! from Rust...111", input))
|
||||
.expect("Couldn't create java string!");
|
||||
|
||||
output.into_inner()
|
||||
}
|
Reference in New Issue
Block a user