diff options
author | das <das> | 2002-02-25 15:21:59 (GMT) |
---|---|---|
committer | das <das> | 2002-02-25 15:21:59 (GMT) |
commit | e6bf045bcbf9d4984bae5b64267c776d41f8d017 (patch) | |
tree | 388bfec4cdc427936eac0a93040f9d244ae0554d | |
parent | 730ef3578f5ee4acee78ad32b67c0dd4e963d911 (diff) | |
download | tcl-e6bf045bcbf9d4984bae5b64267c776d41f8d017.zip tcl-e6bf045bcbf9d4984bae5b64267c776d41f8d017.tar.gz tcl-e6bf045bcbf9d4984bae5b64267c776d41f8d017.tar.bz2 |
* unix/tclLoadDyld.c: updated to use Mac OS X 10.1 dyld APIs that
have more libdl-like semantics. (bug #514392)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | unix/tclLoadDyld.c | 32 |
2 files changed, 25 insertions, 12 deletions
@@ -1,3 +1,8 @@ +2002-02-25 Daniel Steffen <das@users.sourceforge.net> + + * unix/tclLoadDyld.c: updated to use Mac OS X 10.1 dyld APIs that + have more libdl-like semantics. (bug #514392) + 2002-02-25 Miguel Sofer <msofer@users.sourceforge.net> * generic/tclCompCmds: fixing a bug in patch dated 2002-02-22, in diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index a6e16f5..8541416 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -11,10 +11,11 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadDyld.c,v 1.7 2002/01/09 19:09:28 kennykb Exp $ + * RCS: @(#) $Id: tclLoadDyld.c,v 1.8 2002/02/25 15:21:59 das Exp $ */ #include "tclInt.h" +#include "tclPort.h" #include <mach-o/dyld.h> /* @@ -58,18 +59,21 @@ TclpLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr, * this file. */ { NSSymbol symbol; - enum DYLD_BOOL dyld_return; + const struct mach_header *dyld_lib; Tcl_DString newName, ds; char *native; native = Tcl_FSGetNativePath(pathPtr); - dyld_return = NSAddLibrary(native); + dyld_lib = NSAddImage(native, + NSADDIMAGE_OPTION_WITH_SEARCHING | + NSADDIMAGE_OPTION_RETURN_ON_ERROR); - if (dyld_return != TRUE) { - Tcl_AppendResult(interp, "dyld: couldn't add library \"", - Tcl_GetString(pathPtr), - "\": ", Tcl_PosixError(interp), (char *) NULL); - return TCL_ERROR; + if (!dyld_lib) { + NSLinkEditErrors editError; + char *name, *msg; + NSLinkEditError(&editError, &errno, &name, &msg); + Tcl_AppendResult(interp, msg, (char *) NULL); + return TCL_ERROR; } *unloadProcPtr = &TclpUnloadFile; @@ -82,8 +86,10 @@ TclpLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr, Tcl_DStringInit(&newName); Tcl_DStringAppend(&newName, "_", 1); native = Tcl_DStringAppend(&newName, native, -1); - if(NSIsSymbolNameDefined(native)) { - symbol = NSLookupAndBindSymbol(native); + symbol = NSLookupSymbolInImage(dyld_lib, native, + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | + NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + if(symbol) { *proc1Ptr = NSAddressOfSymbol(symbol); *clientDataPtr = NSModuleForSymbol(symbol); } else { @@ -97,8 +103,10 @@ TclpLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr, Tcl_DStringInit(&newName); Tcl_DStringAppend(&newName, "_", 1); native = Tcl_DStringAppend(&newName, native, -1); - if(NSIsSymbolNameDefined(native)) { - symbol = NSLookupAndBindSymbol(native); + symbol = NSLookupSymbolInImage(dyld_lib, native, + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | + NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + if(symbol) { *proc2Ptr = NSAddressOfSymbol(symbol); } else { *proc2Ptr=NULL; |