aboutsummaryrefslogtreecommitdiff
path: root/jim-load.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2011-04-04 14:28:42 +1000
committerSteve Bennett <steveb@workware.net.au>2011-06-09 11:45:57 +1000
commit980235d194353a1ee9109303f5a12bb42f68d6c3 (patch)
treeb139bff3d923c7288952078b0c915abfe776286c /jim-load.c
parent64716bd6592527d31b6c5e79295d0218afc98682 (diff)
downloadjimtcl-980235d194353a1ee9109303f5a12bb42f68d6c3.zip
jimtcl-980235d194353a1ee9109303f5a12bb42f68d6c3.tar.gz
jimtcl-980235d194353a1ee9109303f5a12bb42f68d6c3.tar.bz2
Better handling of environ on Mac OS X
Shared libraries can't access environ directly, so use _NSGetEnviron() on Mac OS X Also, load modules with (RTLD_NOW | RTLD_LOCAL) instead of RTLD_LAZY Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-load.c')
-rw-r--r--jim-load.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/jim-load.c b/jim-load.c
index 6047839..8877260 100644
--- a/jim-load.c
+++ b/jim-load.c
@@ -12,6 +12,13 @@
#include <dlfcn.h>
#endif
+#ifndef RTLD_NOW
+ #define RTLD_NOW 0
+#endif
+#ifndef RTLD_LOCAL
+ #define RTLD_LOCAL 0
+#endif
+
/**
* Note that Jim_LoadLibrary() requires a path to an existing file.
*
@@ -19,7 +26,7 @@
*/
int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName)
{
- void *handle = dlopen(pathName, RTLD_LAZY);
+ void *handle = dlopen(pathName, RTLD_NOW | RTLD_LOCAL);
if (handle == NULL) {
Jim_SetResultFormatted(interp, "error loading extension \"%s\": %s", pathName,
dlerror());