![]() Arbitrary Java objects, on the other hand, are passed by reference. Primitive types, such as integers, characters, and so on, are copied between Java and native code. For a static native method is a reference to its Java class. For a nonstatic native method, it is a reference to the instance object of it Java class. This argument differs depending on whether the native method is static or nonstatic. A native method, therefore, must not pass the interface pointer from one thread to another. The JNI interface pointer is only valid in the current thread. Figure at illustrates the organization of an interface pointer. Every interface function is at a predefined offset inside the array. This pointer points to an array of pointers, each of which points to an interface function. An JNI interface pointer is a pointer to a pointer. The JNI interface is organized like a C++ virtual function table or a COM interface. Load classes and obtain class information.Ī) The first argument - JNI interface pointer ![]() You want to implement a small portion of time-critical code in a lower-level language such as assembly.Ĭreate, inspect, and update Java objects (including arrays and strings). You already have a library written in another language, and wish to make it accessible to Java code through the JNI. The standard Java class library does not support the platform-dependent features needed by the application. For Android, JNI can be used from 1.5 and later, and Android 2.3 introduces NativeActivity that enable you to implement an activity purely in native code. It allows Java code that runs inside a Java Virtual Machine (VM) to interoperate with applications and libraries written in other programming languages, such as C, C++, and assembly. The JNI(Java Native Interface) is a native programming interface. (include more details and some usefule sample) Java Native Interface: Programmer's Guide and Specification Java Native Interface Specification-Contents
0 Comments
Leave a Reply. |