From e1b3c7801397c8d793772bdf3a4cfbce9912feff Mon Sep 17 00:00:00 2001 From: "Konstantin S. Matveyev" Date: Fri, 29 Mar 2019 16:25:43 +0300 Subject: [PATCH] osgDB::DynamicLibrary: local lib loading on Android fixed --- src/osgDB/DynamicLibrary.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osgDB/DynamicLibrary.cpp b/src/osgDB/DynamicLibrary.cpp index 0fe9256c6..b9a47df5f 100644 --- a/src/osgDB/DynamicLibrary.cpp +++ b/src/osgDB/DynamicLibrary.cpp @@ -113,6 +113,11 @@ DynamicLibrary::HANDLE DynamicLibrary::getLibraryHandle( const std::string& libr return handle; #else // other unix +#if defined(__ANDROID__) + // Library can be found in APK/lib/armeabi-v7a etc. + // Should not be prefaced with './' + std::string localLibraryName = libraryName; +#else // dlopen will not work with files in the current directory unless // they are prefaced with './' (DB - Nov 5, 2003). std::string localLibraryName; @@ -120,6 +125,7 @@ DynamicLibrary::HANDLE DynamicLibrary::getLibraryHandle( const std::string& libr localLibraryName = "./" + libraryName; else localLibraryName = libraryName; +#endif handle = dlopen( localLibraryName.c_str(), RTLD_LAZY | RTLD_GLOBAL); if( handle == NULL )