summaryrefslogtreecommitdiffstats
path: root/unix/tclLoadShl.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclLoadShl.c')
-rw-r--r--unix/tclLoadShl.c53
1 files changed, 13 insertions, 40 deletions
diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c
index 9656983..8aaefda 100644
--- a/unix/tclLoadShl.c
+++ b/unix/tclLoadShl.c
@@ -12,25 +12,8 @@
*/
#include <dl.h>
-
-/*
- * On some HP machines, dl.h defines EXTERN; remove that definition.
- */
-
-#ifdef EXTERN
-# undef EXTERN
-#endif
-
#include "tclInt.h"
-/* Static functions defined within this file */
-
-static void* FindSymbol(Tcl_Interp* interp, Tcl_LoadHandle loadHandle,
- const char* symbol);
-static void
-UnloadFile(Tcl_LoadHandle handle);
-
-
/*
*----------------------------------------------------------------------
*
@@ -63,8 +46,7 @@ TclpDlopen(
* file. */
{
shl_t handle;
- Tcl_LoadHandle newHandle;
- const char *native;
+ CONST char *native;
char *fileName = Tcl_GetString(pathPtr);
/*
@@ -104,18 +86,15 @@ TclpDlopen(
Tcl_PosixError(interp), (char *) NULL);
return TCL_ERROR;
}
- newHandle = ckalloc(sizeof(*newHandle));
- newHandle->clientData = handle;
- newHandle->findSymbolProcPtr = &FindSymbol;
- newHandle->unloadFileProcPtr = *unloadProcPtr = &UnloadFile;
- *loadHandle = newHandle;
+ *loadHandle = (Tcl_LoadHandle) handle;
+ *unloadProcPtr = &TclpUnloadFile;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * Tcl_FindSymbol --
+ * TclpFindSymbol --
*
* Looks up a symbol, by name, through a handle associated with a
* previously loaded piece of code (shared library).
@@ -128,15 +107,15 @@ TclpDlopen(
*----------------------------------------------------------------------
*/
-static void*
-FindSymbol(
+Tcl_PackageInitProc *
+TclpFindSymbol(
Tcl_Interp *interp,
Tcl_LoadHandle loadHandle,
- const char *symbol)
+ CONST char *symbol)
{
Tcl_DString newName;
Tcl_PackageInitProc *proc = NULL;
- shl_t handle = (shl_t)(loadHandle->clientData);
+ shl_t handle = (shl_t)loadHandle;
/*
* Some versions of the HP system software still use "_" at the beginning
@@ -154,18 +133,13 @@ FindSymbol(
}
Tcl_DStringFree(&newName);
}
- if (proc == NULL && interp != NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot find symbol\"", symbol,
- "\": ", Tcl_PosixError(interp), NULL);
- }
return proc;
}
/*
*----------------------------------------------------------------------
*
- * UnloadFile --
+ * TclpUnloadFile --
*
* Unloads a dynamically loaded binary code file from memory. Code
* pointers in the formerly loaded file are no longer valid after calling
@@ -180,17 +154,16 @@ FindSymbol(
*----------------------------------------------------------------------
*/
-static void
-UnloadFile(
+void
+TclpUnloadFile(
Tcl_LoadHandle 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) (loadHandle -> clientData);
+ handle = (shl_t) loadHandle;
shl_unload(handle);
- ckfree(loadHandle);
}
/*
@@ -215,7 +188,7 @@ UnloadFile(
int
TclGuessPackageName(
- const char *fileName, /* Name of file containing package (already
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */