From dc66073417134baa9397cc7ab687dabcc1f564b7 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 1 May 2018 11:27:46 -0700 Subject: [PATCH] Document the historical dlopen issues. Bug: https://groups.google.com/forum/#!topic/android-ndk/OJxg_550eHE Test: N/A Change-Id: Ife066dcd3af89952f81f0aefc33351c59b83be9b --- android-changes-for-ndk-developers.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md index e4eb48a85..1630db8e4 100644 --- a/android-changes-for-ndk-developers.md +++ b/android-changes-for-ndk-developers.md @@ -30,6 +30,21 @@ as toasts. Experience has shown that many developers don’t habitually check logcat for warnings until their app stops functioning, so the toasts help bring some visibility to the issues before it's too late. +## Changes to library dependency resolution + +Until it was [fixed](https://issuetracker.google.com/36950617) in +JB-MR2, Android didn't include the application library directory +on the dynamic linker's search path. This meant that apps +had to call `dlopen` or `System.loadLibrary` on all transitive +dependencies before loading their main library. Worse, until it was +[fixed](https://issuetracker.google.com/36935779) in JB-MR2, the +dynamic linker's caching code cached failures too, so it was necessary +to topologically sort your libraries and load them in reverse order. + +If you need to support Android devices running OS +versions older than JB-MR2, you might want to consider +[ReLinker](https://github.com/KeepSafe/ReLinker) which claims to solve +these problems automatically. ## Changes to library search order