* 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/>.
*/
/*
/*
* MT safe
*/
+#include "config.h"
#include <dlfcn.h>
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));
* 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));
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;
}
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);
}