Commit cb6cf5e2 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix/modjni: Add env() module function.

Useful to load native method libraries not loaded by VM (as happens on
Android).
parent 661d9d19
......@@ -409,9 +409,15 @@ STATIC mp_obj_t mod_jni_cls(mp_obj_t cls_name_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mod_jni_cls_obj, mod_jni_cls);
STATIC mp_obj_t mod_jni_env() {
return mp_obj_new_int((mp_int_t)env);
}
MP_DEFINE_CONST_FUN_OBJ_0(mod_jni_env_obj, mod_jni_env);
STATIC const mp_map_elem_t mp_module_jni_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_jni) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_cls), (mp_obj_t)&mod_jni_cls_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_env), (mp_obj_t)&mod_jni_env_obj },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_jni_globals, mp_module_jni_globals_table);
......
......@@ -106,6 +106,7 @@ Q(B115200)
#if MICROPY_PY_JNI
Q(jni)
Q(cls)
Q(env)
Q(jclass)
Q(jobject)
Q(jmethod)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment