diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2016-05-04 23:38:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-05-04 23:38:55 +0000 |
commit | ad717d6566eb381fb0ef47941c000789f048cf81 (patch) | |
tree | 7f790289ef9df142a64b2b81d0c46e9546453fec /libnativeloader | |
parent | f9f76146a1d0f05654be8963e78c2ed6c56d4a57 (diff) | |
parent | 7a1f9518f77e33e40efcec7ace0ee5d3855ccd8b (diff) | |
download | core-ad717d6566eb381fb0ef47941c000789f048cf81.tar.gz core-ad717d6566eb381fb0ef47941c000789f048cf81.tar.bz2 core-ad717d6566eb381fb0ef47941c000789f048cf81.zip |
Merge "nativeloader: Add CloseNativeLibrary() method"
Diffstat (limited to 'libnativeloader')
-rw-r--r-- | libnativeloader/include/nativeloader/native_loader.h | 3 | ||||
-rw-r--r-- | libnativeloader/native_loader.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libnativeloader/include/nativeloader/native_loader.h b/libnativeloader/include/nativeloader/native_loader.h index d606a760e..2a6aaec50 100644 --- a/libnativeloader/include/nativeloader/native_loader.h +++ b/libnativeloader/include/nativeloader/native_loader.h @@ -43,6 +43,9 @@ void* OpenNativeLibrary(JNIEnv* env, jobject class_loader, jstring library_path); +__attribute__((visibility("default"))) +bool CloseNativeLibrary(void* handle); + #if defined(__ANDROID__) // Look up linker namespace by class_loader. Returns nullptr if // there is no namespace associated with the class_loader. diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 72152e737..7d9bb567f 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -241,6 +241,10 @@ void* OpenNativeLibrary(JNIEnv* env, #endif } +bool CloseNativeLibrary(void* handle) { + return dlclose(handle) == 0; +} + #if defined(__ANDROID__) android_namespace_t* FindNamespaceByClassLoader(JNIEnv* env, jobject class_loader) { std::lock_guard<std::mutex> guard(g_namespaces_mutex); |