mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-16 12:28:48 +02:00
applied patch from David Schleef <ds@schleef.org> which implements a
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org> * applied patch from David Schleef <ds@schleef.org> which implements a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global symbol registration.
This commit is contained in:
parent
fb464bde99
commit
defca980e4
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* applied patch from David Schleef <ds@schleef.org> which implements
|
||||||
|
a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global
|
||||||
|
symbol registration.
|
||||||
|
|
||||||
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* applied patch from David Schleef <ds@schleef.org> which implements
|
||||||
|
a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global
|
||||||
|
symbol registration.
|
||||||
|
|
||||||
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* applied patch from David Schleef <ds@schleef.org> which implements
|
||||||
|
a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global
|
||||||
|
symbol registration.
|
||||||
|
|
||||||
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* applied patch from David Schleef <ds@schleef.org> which implements
|
||||||
|
a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global
|
||||||
|
symbol registration.
|
||||||
|
|
||||||
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* applied patch from David Schleef <ds@schleef.org> which implements
|
||||||
|
a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global
|
||||||
|
symbol registration.
|
||||||
|
|
||||||
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 20 02:39:03 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* applied patch from David Schleef <ds@schleef.org> which implements
|
||||||
|
a G_MODULE_BIND_LOCAL flag to g_module_open() to disable global
|
||||||
|
symbol registration.
|
||||||
|
|
||||||
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
Thu Feb 19 18:40:01 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
* glib/gstring.[hc]: for G_CAN_INLINE environments, inline
|
||||||
|
@ -108,8 +108,8 @@ eventually that fails as well, %NULL is returned.
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@file_name: the name of the file containing the module.
|
@file_name: the name of the file containing the module.
|
||||||
@flags: the flags used for opening the module. Currently this can be 0 or
|
@flags: the flags used for opening the module. This can be the logical
|
||||||
#G_MODULE_BIND_LAZY for lazy binding, where symbols are only bound when needed.
|
OR of any of the #GModuleFlags.
|
||||||
@Returns: a #GModule on success, or %NULL on failure.
|
@Returns: a #GModule on success, or %NULL on failure.
|
||||||
|
|
||||||
|
|
||||||
@ -119,9 +119,15 @@ Flags passed to g_module_open().
|
|||||||
#G_MODULE_BIND_LAZY specifies that symbols are only resolved when needed.
|
#G_MODULE_BIND_LAZY specifies that symbols are only resolved when needed.
|
||||||
The default action is to bind all symbols when the module is loaded.
|
The default action is to bind all symbols when the module is loaded.
|
||||||
(#G_MODULE_BIND_LAZY is not supported on all platforms.)
|
(#G_MODULE_BIND_LAZY is not supported on all platforms.)
|
||||||
|
#G_MODULE_BIND_LOCAL specifies that symbols in the module should
|
||||||
|
not be added to the global name space. The default action on most
|
||||||
|
platforms is to place symbols in the module in the global name space,
|
||||||
|
which may cause conflicts with existing symbols.
|
||||||
|
(#G_MODULE_BIND_LOCAL is not supported on all platforms.)
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@G_MODULE_BIND_LAZY:
|
@G_MODULE_BIND_LAZY:
|
||||||
|
@G_MODULE_BIND_LOCAL:
|
||||||
@G_MODULE_BIND_MASK:
|
@G_MODULE_BIND_MASK:
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_module_symbol ##### -->
|
<!-- ##### FUNCTION g_module_symbol ##### -->
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
* different image_id's. While this means that we don't have to worry about
|
* different image_id's. While this means that we don't have to worry about
|
||||||
* reference counts, it could lead to problems in the future....
|
* reference counts, it could lead to problems in the future....
|
||||||
* richard.
|
* richard.
|
||||||
|
*
|
||||||
|
* load_add_on() apparently does not support lazy or local binding. Need
|
||||||
|
* to confirm that the actual behavior is non-lazy/local. --ds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Errors.h>
|
#include <Errors.h>
|
||||||
@ -56,7 +59,8 @@
|
|||||||
/* --- functions --- */
|
/* --- functions --- */
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
image_id handle;
|
image_id handle;
|
||||||
|
|
||||||
|
@ -90,11 +90,13 @@ fetch_dlerror (gboolean replace_null)
|
|||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
gpointer handle;
|
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)
|
if (!handle)
|
||||||
g_module_set_error (fetch_dlerror (TRUE));
|
g_module_set_error (fetch_dlerror (TRUE));
|
||||||
|
|
||||||
|
@ -67,9 +67,21 @@
|
|||||||
|
|
||||||
|
|
||||||
/* --- functions --- */
|
/* --- functions --- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* shl_load() does not appear to support making symbols invisible to
|
||||||
|
* the global namespace. However, the default is to put the library
|
||||||
|
* last in the search order, which is approximately what we want,
|
||||||
|
* since it will cause symbols that conflict with existing symbols to
|
||||||
|
* be invisible. It is unclear if BIND_FIRST should be used when
|
||||||
|
* bind_local==0, since it may cause the loaded symbols to be used
|
||||||
|
* preferentially to the application's symbols, which is Almost
|
||||||
|
* Always Wrong. --ds
|
||||||
|
*/
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
shl_t shl_handle;
|
shl_t shl_handle;
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ static gpointer self_module = GINT_TO_POINTER (1);
|
|||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
NSObjectFileImage image;
|
NSObjectFileImage image;
|
||||||
NSObjectFileImageReturnCode ret;
|
NSObjectFileImageReturnCode ret;
|
||||||
@ -66,7 +67,9 @@ _g_module_open (const gchar *file_name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
options = NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE;
|
options = NSLINKMODULE_OPTION_RETURN_ON_ERROR;
|
||||||
|
if (bind_local)
|
||||||
|
options |= NSLINKMODULE_OPTION_PRIVATE;
|
||||||
if (!bind_lazy)
|
if (!bind_lazy)
|
||||||
options |= NSLINKMODULE_OPTION_BINDNOW;
|
options |= NSLINKMODULE_OPTION_BINDNOW;
|
||||||
module = NSLinkModule (image, file_name, options);
|
module = NSLinkModule (image, file_name, options);
|
||||||
|
@ -68,11 +68,13 @@
|
|||||||
/* --- functions --- */
|
/* --- functions --- */
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
gpointer handle;
|
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)
|
if (!handle)
|
||||||
g_module_set_error (dlerror ());
|
g_module_set_error (dlerror ());
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ set_error (void)
|
|||||||
/* --- functions --- */
|
/* --- functions --- */
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
HINSTANCE handle;
|
HINSTANCE handle;
|
||||||
#ifdef G_WITH_CYGWIN
|
#ifdef G_WITH_CYGWIN
|
||||||
|
@ -68,7 +68,8 @@ struct _GModule
|
|||||||
|
|
||||||
/* --- prototypes --- */
|
/* --- prototypes --- */
|
||||||
static gpointer _g_module_open (const gchar *file_name,
|
static gpointer _g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy);
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local);
|
||||||
static void _g_module_close (gpointer handle,
|
static void _g_module_close (gpointer handle,
|
||||||
gboolean is_unref);
|
gboolean is_unref);
|
||||||
static gpointer _g_module_self (void);
|
static gpointer _g_module_self (void);
|
||||||
@ -153,7 +154,8 @@ g_module_set_error (const gchar *error)
|
|||||||
"not supported by this system"); return rv; }
|
"not supported by this system"); return rv; }
|
||||||
static gpointer
|
static gpointer
|
||||||
_g_module_open (const gchar *file_name,
|
_g_module_open (const gchar *file_name,
|
||||||
gboolean bind_lazy)
|
gboolean bind_lazy,
|
||||||
|
gboolean bind_local)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -384,7 +386,8 @@ g_module_open (const gchar *file_name,
|
|||||||
name = real_name;
|
name = real_name;
|
||||||
}
|
}
|
||||||
if (name)
|
if (name)
|
||||||
handle = _g_module_open (name, (flags & G_MODULE_BIND_LAZY) != 0);
|
handle = _g_module_open (name, (flags & G_MODULE_BIND_LAZY) != 0,
|
||||||
|
(flags & G_MODULE_BIND_LOCAL) != 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_module_set_error_unduped (g_strdup_printf ("unable to access file \"%s\"", file_name));
|
g_module_set_error_unduped (g_strdup_printf ("unable to access file \"%s\"", file_name));
|
||||||
|
@ -44,7 +44,8 @@ G_BEGIN_DECLS
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
G_MODULE_BIND_LAZY = 1 << 0,
|
G_MODULE_BIND_LAZY = 1 << 0,
|
||||||
G_MODULE_BIND_MASK = 0x01
|
G_MODULE_BIND_LOCAL = 1 << 1,
|
||||||
|
G_MODULE_BIND_MASK = 0x03
|
||||||
} GModuleFlags;
|
} GModuleFlags;
|
||||||
|
|
||||||
typedef struct _GModule GModule;
|
typedef struct _GModule GModule;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user