Closed Dreaming-Codes closed 1 month ago
Is there any way to access JNIEnv?
Yes.
You can get full access to Java/JNI interface via foreigner_code
,
see appropriate section in documentation.
Or you can use implicit env
variable in "inline" methods:
foreign_class!(
class LoggingInit {
fn init() {
println!("Here is env: {env:p}");
}
}
);
flapigen generates something like this:
#[allow(non_snake_case, unused_variables, unused_mut, unused_unsafe)]
#[no_mangle]
pub extern "C" fn Java_com_example_rust_LoggingInit_init(env: *mut JNIEnv, _: jclass) -> () {
let mut ret: () = {
println!("Here is env: {env:p}");
};
ret
}
Thanks
Is there any way to access JNIEnv? I'm asking this since I would like to use https://crates.io/crates/log4j