hook gvariant vectors up to kdbus
[platform/upstream/glib.git] / gmodule / gmodule-dl.c
index 3ea4493..20225df 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -27,6 +25,7 @@
 /* 
  * MT safe
  */
+#include "config.h"
 
 #include <dlfcn.h>
 
@@ -90,11 +89,13 @@ fetch_dlerror (gboolean replace_null)
 
 static gpointer
 _g_module_open (const gchar *file_name,
-               gboolean     bind_lazy)
+               gboolean     bind_lazy,
+               gboolean     bind_local)
 {
   gpointer handle;
   
-  handle = dlopen (file_name, RTLD_GLOBAL | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
+  handle = dlopen (file_name,
+                  (bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
   if (!handle)
     g_module_set_error (fetch_dlerror (TRUE));
   
@@ -110,7 +111,11 @@ _g_module_self (void)
    * are required on some systems.
    */
   
+#ifdef __BIONIC__
+  handle = RTLD_DEFAULT;
+#else
   handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
+#endif
   if (!handle)
     g_module_set_error (fetch_dlerror (TRUE));
   
@@ -138,10 +143,13 @@ _g_module_symbol (gpointer     handle,
                  const gchar *symbol_name)
 {
   gpointer p;
-  
+  gchar *msg;
+
+  fetch_dlerror (FALSE);
   p = dlsym (handle, symbol_name);
-  if (!p)
-    g_module_set_error (fetch_dlerror (FALSE));
+  msg = fetch_dlerror (FALSE);
+  if (msg)
+    g_module_set_error (msg);
   
   return p;
 }
@@ -154,9 +162,9 @@ _g_module_build_path (const gchar *directory,
     if (strncmp (module_name, "lib", 3) == 0)
       return g_strconcat (directory, "/", module_name, NULL);
     else
-      return g_strconcat (directory, "/lib", module_name, ".so", NULL);
+      return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL);
   } else if (strncmp (module_name, "lib", 3) == 0)
     return g_strdup (module_name);
   else
-    return g_strconcat ("lib", module_name, ".so", NULL);
+    return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL);
 }