summaryrefslogtreecommitdiffstats
path: root/unix/tclLoadDl.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-11-19 22:10:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-11-19 22:10:10 (GMT)
commit6ba5327e8579861a348ee361e3aff04356086458 (patch)
tree9790caf5f3e563afb49a9b98f35fe6c8f92fb8df /unix/tclLoadDl.c
parent2e165c349a1c7b8d6a62f5b97adfff7f2b0ae80f (diff)
parent094f23c172acca8f32b0888cd536f01fc1daab1b (diff)
downloadtcl-6ba5327e8579861a348ee361e3aff04356086458.zip
tcl-6ba5327e8579861a348ee361e3aff04356086458.tar.gz
tcl-6ba5327e8579861a348ee361e3aff04356086458.tar.bz2
merge trunk
Diffstat (limited to 'unix/tclLoadDl.c')
-rw-r--r--unix/tclLoadDl.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index 9ff7657..dc711f8 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 & TCL_LOAD_GLOBAL) {
+ dlopenflags |= RTLD_GLOBAL;
+ } else {
+ dlopenflags |= RTLD_LOCAL;
+ }
+ if (flags & TCL_LOAD_LAZY) {
+ 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);
}
@@ -153,7 +164,7 @@ FindSymbol(
const char *native; /* Name of the library to be loaded, in
* system encoding */
Tcl_DString newName, ds; /* Buffers for converting the name to
- * system encoding and prepending an
+ * system encoding and prepending an
* underscore*/
void *handle = (void *) loadHandle->clientData;
/* Native handle to the loaded library */