diff options
| author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-10-24 13:08:34 (GMT) |
|---|---|---|
| committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-10-24 13:08:34 (GMT) |
| commit | 5d55eeb5e44ed634315853b81bc6a1a1113291cb (patch) | |
| tree | 9a3dcf1843cffc067eb04f21c109c536a20ff564 /unix/tclLoadDl.c | |
| parent | 3cf81b3149b8eb4c7c401ffed66730f15d7f306f (diff) | |
| download | tcl-5d55eeb5e44ed634315853b81bc6a1a1113291cb.zip tcl-5d55eeb5e44ed634315853b81bc6a1a1113291cb.tar.gz tcl-5d55eeb5e44ed634315853b81bc6a1a1113291cb.tar.bz2 | |
experimental implementation of FRQ-3579001
Diffstat (limited to 'unix/tclLoadDl.c')
| -rw-r--r-- | unix/tclLoadDl.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 9ff7657..9c021e1 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -75,6 +75,7 @@ TclpDlopen( void *handle; Tcl_LoadHandle newHandle; const char *native; + int dlopenflags = 0; /* * First try the full path the user gave us. This is particularly @@ -84,9 +85,19 @@ TclpDlopen( native = Tcl_FSGetNativePath(pathPtr); /* - * Use (RTLD_NOW|RTLD_LOCAL) always, see [Bug #3216070] + * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070] */ - handle = dlopen(native, RTLD_NOW | RTLD_LOCAL); + if (flags & 1) { + dlopenflags |= RTLD_GLOBAL; + } else { + dlopenflags |= RTLD_LOCAL; + } + if (flags & 2) { + dlopenflags |= RTLD_LAZY; + } else { + dlopenflags |= RTLD_NOW; + } + handle = dlopen(native, dlopenflags); if (handle == NULL) { /* * Let the OS loader examine the binary search path for whatever @@ -99,9 +110,9 @@ TclpDlopen( native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds); /* - * Use (RTLD_NOW|RTLD_LOCAL) always, see [Bug #3216070] + * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070] */ - handle = dlopen(native, RTLD_NOW | RTLD_LOCAL); + handle = dlopen(native, dlopenflags); Tcl_DStringFree(&ds); } |
