This change could result in multiple instances of the shared library being
loaded when using alternate paths. This will be addressed by b/
18752589.
Change-Id: Icf26a0c6f76edfd4f1c710e14f1005138d97e77a
Reviewed-on: https://swiftshader-review.googlesource.com/2664
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
\r
inline void *getLibraryHandle(const char *path)\r
{\r
- void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD);\r
-\r
- if(resident)\r
- {\r
- return dlopen(path, RTLD_LAZY); // Increment reference count\r
- }\r
-\r
- return 0;\r
+ #ifdef __ANDROID__\r
+ // bionic doesn't support RTLD_NOLOAD before L\r
+ return dlopen(path, RTLD_NOW);\r
+ #else\r
+ void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD);\r
+\r
+ if(resident)\r
+ {\r
+ return dlopen(path, RTLD_LAZY); // Increment reference count\r
+ }\r
+\r
+ return 0;\r
+ #endif\r
}\r
\r
inline void freeLibrary(void *library)\r