Android Java中System.loadLibrary() 的執行過程__Java

來源:互聯網
上載者:User

先app,後system


http://my.oschina.net/wolfcs/blog/129696


目錄[-] 系統的library path Native 層load library的過程

System.loadLibrary()是我們在使用Java的JNI機制時,會用到的一個非常重要的函數,它的作用即是把實現了我們在Java code中聲明的native方法的那個libraryload進來,或者load其他什麼動態串連庫。

算是處於好奇吧,我們可以看一下這個方法它的實現,即執行流程。(下面分析的那些code,來自於android 4.2.2 aosp版。)先看一下這個方法的code(在libcore/luni/src/main/java/java/lang/System.java這個檔案中): ?

1 2 3 4 5 6 7 8 9 10 11 12 13 /**   * Loads and links the library with the specified name. The mapping of the   * specified library name to the full path for loading the library is   * implementation-dependent.   *   * @param libName   *            the name of the library to load.   * @throws UnsatisfiedLinkError   *             if the library could no<span style="color:#003399;"></span>t be loaded.  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.