From 7b43d311fea58e6fd14317f72ec40c84c5c21fc6 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Thu, 14 Dec 2017 10:58:47 +0000 Subject: COMPMID-556: Don't call dlclose Calling dlclose on a handle meanse the library will get unloaded and therefore its symbols won't be valid anymore. Shared libraries are automatically unloaded when the application exits, so we can just 'leak' the handles. https://stackoverflow.com/questions/26131102/is-it-safe-to-call-dlclose-after-dlsym Change-Id: I8991af0887e5e48108fe787a77e003dd7c872361 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/113264 Reviewed-by: Michalis Spyrou Reviewed-by: Gian Marco Iodice Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com --- src/core/CL/OpenCL.cpp | 2 +- src/core/GLES_COMPUTE/OpenGLES.cpp | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/core/CL/OpenCL.cpp b/src/core/CL/OpenCL.cpp index 3a145e0ab3..157b6d6820 100644 --- a/src/core/CL/OpenCL.cpp +++ b/src/core/CL/OpenCL.cpp @@ -110,7 +110,7 @@ bool CLSymbols::load(const std::string &library) #undef LOAD_FUNCTION_PTR - dlclose(handle); + //Don't call dlclose(handle) or all the symbols will be unloaded ! // Disable default loading and set status to successful _loaded = std::make_pair(true, true); diff --git a/src/core/GLES_COMPUTE/OpenGLES.cpp b/src/core/GLES_COMPUTE/OpenGLES.cpp index fdfc085db2..d2539d0775 100644 --- a/src/core/GLES_COMPUTE/OpenGLES.cpp +++ b/src/core/GLES_COMPUTE/OpenGLES.cpp @@ -128,15 +128,7 @@ private: } } - if(glesv3_handle != nullptr) - { - dlclose(glesv3_handle); - } - if(glesv2_handle != nullptr) - { - dlclose(glesv2_handle); - } - dlclose(egl_handle); + //Don't call dlclose(handle) or all the symbols will be unloaded ! } } bool _initialized = false; -- cgit v1.2.1