diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-04-04 14:28:42 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-06-09 11:45:57 +1000 |
commit | 980235d194353a1ee9109303f5a12bb42f68d6c3 (patch) | |
tree | b139bff3d923c7288952078b0c915abfe776286c /jim-load.c | |
parent | 64716bd6592527d31b6c5e79295d0218afc98682 (diff) | |
download | jimtcl-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.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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()); |