1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#[doc(hidden)] pub use ::std as std;
#[doc(hidden)] pub use ::jni_sys as jni_sys;
use jni_sys::*;
use lazy_static::*;
use std::ffi::*;
use std::ptr::*;
use std::marker::PhantomData;
use std::ops::Deref;
use std::sync::*;
pub(crate) mod backends {
use super::*;
mod single_vm_backend;
pub(crate) use single_vm_backend::*;
}
mod refs {
use super::*;
mod argument;
mod global;
mod local;
mod ref_;
pub use argument::*;
pub use global::*;
pub use local::*;
pub use ref_::*;
}
mod __jni_bindgen;
mod array;
mod as_jvalue;
mod as_valid_jobject_and_env;
mod env;
mod gen_vm;
mod jchar_;
mod jni_type;
mod object_and_env;
mod string_chars;
mod throwable_type;
mod vm;
pub use array::*;
pub use as_jvalue::*;
pub use as_valid_jobject_and_env::*;
pub use env::*;
pub(crate) use gen_vm::*;
pub use jchar_::{jchar, *};
pub use jni_type::JniType;
pub use object_and_env::*;
pub use refs::*;
pub use string_chars::*;
pub use throwable_type::*;
pub use vm::*;
type VmBackend = backends::SingleVmBackend;
lazy_static! {
static ref VMS : RwLock<VmBackend> = RwLock::new(VmBackend::new());
}
#[cfg(feature = "unsafe-manual-jni-load-unload")]
pub unsafe fn on_load(vm: *const JavaVM, _reserved: *const c_void) -> jint {
VMS.write().unwrap().on_load(vm);
JNI_VERSION_1_2
}
#[cfg(feature = "unsafe-manual-jni-load-unload")]
pub fn on_unload(vm: *const JavaVM, _reserved: *const c_void) {
VMS.write().unwrap().on_unload(vm);
}
#[no_mangle] #[allow(non_snake_case)] #[cfg(not(feature = "unsafe-manual-jni-load-unload"))]
pub unsafe extern "system" fn JNI_OnLoad(vm: *const JavaVM, _reserved: *const c_void) -> jint {
VMS.write().unwrap().on_load(vm);
JNI_VERSION_1_2
}
#[no_mangle] #[allow(non_snake_case)] #[cfg(not(feature = "unsafe-manual-jni-load-unload"))]
pub extern "system" fn JNI_OnUnload(vm: *const JavaVM, _reserved: *const c_void) {
VMS.write().unwrap().on_unload(vm);
}