Allow RTLD_GLOBAL to be optional
- From: Martin Baulig <martin home-of-linux org>
- To: gtk-devel-list gnome org
- Subject: Allow RTLD_GLOBAL to be optional
- Date: 21 Apr 2001 00:30:42 +0200
Hi guys,
can you please add G_MODULE_BIND_PRIVATE or something like
this to GModuleFlags which will tell gmodule not to use
RTLD_GLOBAL ?
Yes, I really want to use g_module_symbol() for each symbol of
my shared library and yes, I really do not want to export its
symbols.
If you still don't see why this is necessary and why someone
may want such a "strange" feature, lemme explain:
I have several shared libraries, each of them containing some
global symbol, let's call it `foo'. If I don't give dlopen() the
RTLD_GLOBAL flag, I can load them all into my application and then
use dlsym() to get `foo'.
When I use gmodule and not dlopen/dlsym directly, this always
crashes - imagine the following situation:
Library A:
====
void
bar (void)
{
g_message (G_STRLOC " - Library A");
}
void
foo (void)
{
g_message (G_STRLOC " - Library A");
bar ();
}
===
Library B:
====
void
bar (void)
{
g_message (G_STRLOC " - Library B");
}
void
foo (void)
{
g_message (G_STRLOC " - Library B");
bar ();
}
===
If I use dlopen without RTLD_GLOBAL, loading both A and B into my application
and then calling both foo's via dlsym() works just fine.
With gmodule, B's foo() calls A's bar().
--
Martin Baulig
martin gnome org (private)
baulig suse de (work)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]