Commit e79c6b63 authored by Paul Sokolovsky's avatar Paul Sokolovsky

unix/modjni: "jni" module to interface to JNI-compliant JavaVM.

This includes Android Dalvik VM for example.

Example usage:

import jni
System = jni.cls("java/lang/System")
System.out.println("Hello, Java!")
parent f352fe82
......@@ -101,6 +101,11 @@ LDFLAGS_MOD += $(LIBFFI_LDFLAGS_MOD)
SRC_MOD += modffi.c
endif
ifeq ($(MICROPY_PY_JNI),1)
# Path for 64-bit OpenJDK, should be adjusted for other JDKs
CFLAGS_MOD += -I/usr/lib/jvm/java-7-openjdk-amd64/include -DMICROPY_PY_JNI=1
SRC_MOD += modjni.c
endif
# source files
SRC_C = \
......
This diff is collapsed.
......@@ -123,12 +123,18 @@ extern const struct _mp_obj_module_t mp_module_time;
extern const struct _mp_obj_module_t mp_module_termios;
extern const struct _mp_obj_module_t mp_module_socket;
extern const struct _mp_obj_module_t mp_module_ffi;
extern const struct _mp_obj_module_t mp_module_jni;
#if MICROPY_PY_FFI
#define MICROPY_PY_FFI_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_ffi), (mp_obj_t)&mp_module_ffi },
#else
#define MICROPY_PY_FFI_DEF
#endif
#if MICROPY_PY_JNI
#define MICROPY_PY_JNI_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_jni), (mp_obj_t)&mp_module_jni },
#else
#define MICROPY_PY_JNI_DEF
#endif
#if MICROPY_PY_TIME
#define MICROPY_PY_TIME_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&mp_module_time },
#else
......@@ -147,6 +153,7 @@ extern const struct _mp_obj_module_t mp_module_ffi;
#define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PY_FFI_DEF \
MICROPY_PY_JNI_DEF \
MICROPY_PY_TIME_DEF \
MICROPY_PY_SOCKET_DEF \
{ MP_OBJ_NEW_QSTR(MP_QSTR__os), (mp_obj_t)&mp_module_os }, \
......
......@@ -20,3 +20,6 @@ MICROPY_PY_SOCKET = 1
# ffi module requires libffi (libffi-dev Debian package)
MICROPY_PY_FFI = 1
# jni module requires JVM/JNI
MICROPY_PY_JNI = 0
......@@ -102,3 +102,11 @@ Q(B9600)
Q(B57600)
Q(B115200)
#endif
#if MICROPY_PY_JNI
Q(jni)
Q(cls)
Q(jclass)
Q(jobject)
Q(jmethod)
#endif
Markdown is supported
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