diff options
author | vincentdarley <vincentdarley> | 2002-07-18 15:04:51 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-07-18 15:04:51 (GMT) |
commit | b355103baab13c260a35798a589f4357f9fd115a (patch) | |
tree | f356d5d56da72d498b37011b9e007ccb03fade54 | |
parent | 20f90f51f25cf3474e10150eebc6f1e23f68a0db (diff) | |
download | tcl-b355103baab13c260a35798a589f4357f9fd115a.zip tcl-b355103baab13c260a35798a589f4357f9fd115a.tar.gz tcl-b355103baab13c260a35798a589f4357f9fd115a.tar.bz2 |
load comments and clientData replacement
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tcl.h | 4 | ||||
-rw-r--r-- | generic/tclInt.h | 9 | ||||
-rw-r--r-- | generic/tclLoadNone.c | 29 | ||||
-rw-r--r-- | mac/tclMacLoad.c | 42 | ||||
-rw-r--r-- | unix/tclLoadAout.c | 33 | ||||
-rw-r--r-- | unix/tclLoadDl.c | 34 | ||||
-rw-r--r-- | unix/tclLoadDld.c | 34 | ||||
-rw-r--r-- | unix/tclLoadDyld.c | 36 | ||||
-rw-r--r-- | unix/tclLoadNext.c | 32 | ||||
-rw-r--r-- | unix/tclLoadOSF.c | 32 | ||||
-rw-r--r-- | unix/tclLoadShl.c | 34 | ||||
-rw-r--r-- | win/tclWinLoad.c | 30 |
13 files changed, 252 insertions, 104 deletions
@@ -1,3 +1,10 @@ +2002-07-18 Vince Darley <vincentdarley@users.sourceforge.net> + + * generic/tclInt.h: + * generic/tcl.h: + * */*Load*.c: added comments on changes of 07/17 and + replaced clientData with TclLoadHandle in all locations. + 2002-07-17 Miguel Sofer <msofer@users.sourceforge.net> * generic/tclBasic.c (CallCommandTraces): delete traces now diff --git a/generic/tcl.h b/generic/tcl.h index b2c8ee9..4e67efa 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.132 2002/07/14 17:29:01 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.133 2002/07/18 15:04:53 vincentdarley Exp $ */ #ifndef _TCL @@ -1598,7 +1598,7 @@ typedef int (Tcl_FSRemoveDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int recursive, Tcl_Obj **errorPtr)); typedef int (Tcl_FSRenameFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)); -typedef void (Tcl_FSUnloadFileProc) _ANSI_ARGS_((ClientData clientData)); +typedef void (Tcl_FSUnloadFileProc) _ANSI_ARGS_((TclLoadHandle loadHandle)); typedef Tcl_Obj* (Tcl_FSListVolumesProc) _ANSI_ARGS_((void)); /* We have to declare the utime structure here. */ struct utimbuf; diff --git a/generic/tclInt.h b/generic/tclInt.h index ba9ebc3..9960e16 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.102 2002/07/17 20:00:45 vincentdarley Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.103 2002/07/18 15:04:53 vincentdarley Exp $ */ #ifndef _TCLINT @@ -1762,10 +1762,7 @@ EXTERN void TclpInitPlatform _ANSI_ARGS_((void)); EXTERN void TclpInitUnlock _ANSI_ARGS_((void)); EXTERN int TclpLoadFile _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, - CONST char *sym1, CONST char *sym2, - Tcl_PackageInitProc **proc1Ptr, - Tcl_PackageInitProc **proc2Ptr, - ClientData *clientDataPtr, + TclLoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr)); EXTERN Tcl_Obj* TclpObjListVolumes _ANSI_ARGS_((void)); EXTERN void TclpMasterLock _ANSI_ARGS_((void)); @@ -1812,7 +1809,7 @@ EXTERN char * TclpReadlink _ANSI_ARGS_((CONST char *fileName, Tcl_DString *linkPtr)); EXTERN void TclpReleaseFile _ANSI_ARGS_((TclFile file)); EXTERN void TclpSetVariables _ANSI_ARGS_((Tcl_Interp *interp)); -EXTERN void TclpUnloadFile _ANSI_ARGS_((ClientData clientData)); +EXTERN void TclpUnloadFile _ANSI_ARGS_((TclLoadHandle loadHandle)); EXTERN VOID * TclpThreadDataKeyGet _ANSI_ARGS_(( Tcl_ThreadDataKey *keyPtr)); EXTERN void TclpThreadDataKeyInit _ANSI_ARGS_(( diff --git a/generic/tclLoadNone.c b/generic/tclLoadNone.c index 9d93ba1..878711c 100644 --- a/generic/tclLoadNone.c +++ b/generic/tclLoadNone.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadNone.c,v 1.9 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadNone.c,v 1.10 2002/07/18 15:04:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -18,7 +18,7 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * This procedure is called to carry out dynamic loading of binary * code; it is intended for use only on systems that don't support @@ -53,6 +53,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_ERROR; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -111,10 +126,10 @@ TclGuessPackageName(fileName, bufPtr) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is - * a token that represents the loaded - * file. */ +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is + * a token that represents the loaded + * file. */ { } diff --git a/mac/tclMacLoad.c b/mac/tclMacLoad.c index a36e151..0b411e0 100644 --- a/mac/tclMacLoad.c +++ b/mac/tclMacLoad.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacLoad.c,v 1.13 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacLoad.c,v 1.14 2002/07/18 15:04:53 vincentdarley Exp $ */ #include <CodeFragments.h> @@ -77,6 +77,15 @@ struct CfrgItem { }; typedef struct CfrgItem CfrgItem; +/* + * On MacOS, old shared libraries which contain many code fragments + * cannot, it seems, be loaded in one go. We need to look provide + * the name of a code fragment while we load. Since with the + * separation of the 'load' and 'findsymbol' be do not necessarily + * know a symbol name at load time, we have to store some further + * information in a structure like this so we can ensure we load + * properly in 'findsymbol' if the first attempts didn't work. + */ typedef struct TclMacLoadInfo { int loaded; CFragConnectionID connID; @@ -90,7 +99,7 @@ static int TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo, /* *---------------------------------------------------------------------- * - * TclLoadFile -- + * TclpDlopen -- * * This procedure is called to carry out dynamic loading of binary * code for the Macintosh. This implementation is based on the @@ -147,6 +156,12 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) *unloadProcPtr = &TclpUnloadFile; return TCL_OK; } + +/* + * See the comments about 'struct TclMacLoadInfo' above. This + * function ensures the appropriate library or symbol is + * loaded. + */ static int TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo, CONST char *sym /* native */) @@ -239,6 +254,21 @@ TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo, return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -300,13 +330,13 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { - TclMacLoadInfo *loadInfo = (TclMacLoadInfo *)clientData; + TclMacLoadInfo *loadInfo = (TclMacLoadInfo *)loadHandle; if (loadInfo->loaded) { CloseConnection((CFragConnectionID*) &(loadInfo->connID)); } diff --git a/unix/tclLoadAout.c b/unix/tclLoadAout.c index c4d6254..b8fa8b6 100644 --- a/unix/tclLoadAout.c +++ b/unix/tclLoadAout.c @@ -14,7 +14,7 @@ * and Design Engineering (MADE) Initiative through ARPA contract * F33615-94-C-4400. * - * RCS: @(#) $Id: tclLoadAout.c,v 1.11 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadAout.c,v 1.12 2002/07/18 15:04:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -102,17 +102,14 @@ static void UnlinkSymbolTable _ANSI_ARGS_((void)); /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interp's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interp's result. * * Side effects: * New code suddenly appears in memory. @@ -312,6 +309,22 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ +Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; TclLoadHandle loadHandle; @@ -448,9 +461,9 @@ UnlinkSymbolTable () */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index aa5fab7..c7402aa 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadDl.c,v 1.10 2002/07/17 20:02:43 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadDl.c,v 1.11 2002/07/18 15:04:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -38,17 +38,14 @@ /* *--------------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interp's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interp's result. * * Side effects: * New code suddenly appears in memory. @@ -87,6 +84,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -138,15 +150,15 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { VOID *handle; - handle = (VOID *) clientData; + handle = (VOID *) loadHandle; dlclose(handle); } diff --git a/unix/tclLoadDld.c b/unix/tclLoadDld.c index 99fee26..de0ab6d 100644 --- a/unix/tclLoadDld.c +++ b/unix/tclLoadDld.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadDld.c,v 1.9 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadDld.c,v 1.10 2002/07/18 15:04:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -30,17 +30,14 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interp's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interp's result. * * Side effects: * New code suddenly appears in memory. @@ -99,6 +96,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -127,15 +139,15 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { char *fileName; - handle = (char *) clientData; + handle = (char *) loadHandle; dld_unlink_by_file(handle, 0); ckfree(handle); } diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 9eefd91..e220525 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -11,7 +11,7 @@ * 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.9 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadDyld.c,v 1.10 2002/07/18 15:04:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -21,17 +21,14 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * - * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * Dynamically loads a binary code file into memory and returns + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interpreter's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interpreter's result. * * Side effects: * New code suddenly appears in memory. @@ -72,6 +69,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -124,13 +136,13 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { - NSUnLinkModule(clientData, FALSE); + NSUnLinkModule(loadHandle, FALSE); } /* diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c index cb09d38..67d7e18 100644 --- a/unix/tclLoadNext.c +++ b/unix/tclLoadNext.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadNext.c,v 1.8 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadNext.c,v 1.9 2002/07/18 15:04:54 vincentdarley Exp $ */ #include "tclInt.h" @@ -20,17 +20,14 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interp's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interp's result. * * Side effects: * New code suddenly appears in memory. @@ -72,6 +69,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -106,9 +118,9 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c index 8740feb..45d8ad6 100644 --- a/unix/tclLoadOSF.c +++ b/unix/tclLoadOSF.c @@ -31,7 +31,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadOSF.c,v 1.8 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadOSF.c,v 1.9 2002/07/18 15:04:54 vincentdarley Exp $ */ #include "tclInt.h" @@ -41,17 +41,14 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interp's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interp's result. * * Side effects: * New code suddenly appears in memory. @@ -103,6 +100,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -131,9 +143,9 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c index 14e5b2d..9baadc6 100644 --- a/unix/tclLoadShl.c +++ b/unix/tclLoadShl.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadShl.c,v 1.10 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadShl.c,v 1.11 2002/07/18 15:04:54 vincentdarley Exp $ */ #include <dl.h> @@ -28,17 +28,14 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error - * message is left in the interp's result. *proc1Ptr and *proc2Ptr - * are filled in with the addresses of the symbols given by - * *sym1 and *sym2, or NULL if those symbols can't be found. + * message is left in the interp's result. * * Side effects: * New code suddenly appears in memory. @@ -85,6 +82,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -133,15 +145,15 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { shl_t handle; - handle = (shl_t) clientData; + handle = (shl_t) loadHandle; shl_unload(handle); } diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 48a6c3b..620aa6c 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinLoad.c,v 1.12 2002/07/17 20:00:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinLoad.c,v 1.13 2002/07/18 15:04:54 vincentdarley Exp $ */ #include "tclWinInt.h" @@ -19,11 +19,10 @@ /* *---------------------------------------------------------------------- * - * TclpLoadFile -- + * TclpDlopen -- * * Dynamically loads a binary code file into memory and returns - * the addresses of two procedures within that file, if they - * are defined. + * a handle to the new code. * * Results: * A standard Tcl completion code. If an error occurs, an error @@ -114,6 +113,21 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TclpFindSymbol -- + * + * Looks up a symbol, by name, through a handle associated with + * a previously loaded piece of code (shared library). + * + * Results: + * Returns a pointer to the function associated with 'symbol' if + * it is found. Otherwise returns NULL and may leave an error + * message in the interp's result. + * + *---------------------------------------------------------------------- + */ Tcl_PackageInitProc* TclpFindSymbol(interp, loadHandle, symbol) Tcl_Interp *interp; @@ -159,15 +173,15 @@ TclpFindSymbol(interp, loadHandle, symbol) */ void -TclpUnloadFile(clientData) - ClientData clientData; /* ClientData returned by a previous call - * to TclpLoadFile(). The clientData is +TclpUnloadFile(loadHandle) + TclLoadHandle loadHandle; /* loadHandle returned by a previous call + * to TclpDlopen(). The loadHandle is * a token that represents the loaded * file. */ { HINSTANCE handle; - handle = (HINSTANCE) clientData; + handle = (HINSTANCE) loadHandle; FreeLibrary(handle); } |