JNI/NDK Development Guide (2), jnindk

Source: Internet
Author: User

JNI/NDK Development Guide (2), jnindk
1. Generate the dynamic library. so and store it in the system/lib/of the mobile phone. (How does the APP store. so in this directory ?????), When the Java layer calls the JNI class, the static code System. loadLibrary ("***") is executed to load the dynamic library in the system/lib directory of the mobile phone to the VM.
2. In the so dynamic library, the C component developer initializes through the JNI_OnUnload () function. Of course, the old version of JNI does not have the JNI_OnUnload () function, so the VM can determine whether JNI is a new version or an old version based on the function.
3. The JNI_OnUnload () function can also register various local functions provided by. so (what kind of registration process ???) To VM to accelerate the efficiency of subsequent calls to local functions.
4. as in loading. so calls JNI_OnLoad () immediately to initialize the component. When the VM releases the C component, it also calls the JNI_OnUnload () function for cleanup.
5. my personal understanding about JNIEnv: for example, if an object of the same class is created in multiple threads and the native method of the object is called, a parameter JNIEnv is passed to the native method, indicates the environment in which the native method runs, that is, the thread in which the native method runs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.