summaryrefslogtreecommitdiffstats
path: root/unix/tclLoadDl.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2025-01-16 09:16:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2025-01-16 09:16:53 (GMT)
commiteb701e1cec48b99353df102dad18ae701e957633 (patch)
treea70e9450dfca4b699a515b176c1f4d54238433d1 /unix/tclLoadDl.c
parent2fe25338c3cb272a550045731f0b99ce21a36106 (diff)
parent1345a76e91c7b805f4acb78ee9c151e5067b3850 (diff)
downloadtcl-eb701e1cec48b99353df102dad18ae701e957633.zip
tcl-eb701e1cec48b99353df102dad18ae701e957633.tar.gz
tcl-eb701e1cec48b99353df102dad18ae701e957633.tar.bz2
Add dummy TclpLoadMemoryGetBuffer/TclpLoadMemory for Windows and UNIX, so compiling with TCL_LOAD_FROM_MEMORY succeeds (but fallbacks normally at runtime)
Diffstat (limited to 'unix/tclLoadDl.c')
-rw-r--r--unix/tclLoadDl.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index 14c4327..271bbb0 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -106,7 +106,7 @@ TclpDlopen(
*/
Tcl_DString ds;
- const char *fileName = Tcl_GetString(pathPtr);
+ const char *fileName = TclGetString(pathPtr);
native = Tcl_UtfToExternalDString(NULL, fileName, TCL_INDEX_NONE, &ds);
/*
@@ -127,7 +127,7 @@ TclpDlopen(
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't load file \"%s\": %s",
- Tcl_GetString(pathPtr), errorStr));
+ TclGetString(pathPtr), errorStr));
}
return TCL_ERROR;
}
@@ -168,7 +168,7 @@ FindSymbol(
Tcl_DString newName, ds; /* Buffers for converting the name to
* system encoding and prepending an
* underscore*/
- void *handle = (void *) loadHandle->clientData;
+ void *handle = loadHandle->clientData;
/* Native handle to the loaded library */
void *proc; /* Address corresponding to the resolved
* symbol */
@@ -260,6 +260,36 @@ UnloadFile(
}
/*
+ * These functions are fallbacks if we somehow determine that the platform can
+ * do loading from memory but the user wishes to disable it. They just report
+ * (gracefully) that they fail.
+ */
+
+#ifdef TCL_LOAD_FROM_MEMORY
+
+MODULE_SCOPE void *
+TclpLoadMemoryGetBuffer(
+ TCL_UNUSED(size_t))
+{
+ return NULL;
+}
+
+MODULE_SCOPE int
+TclpLoadMemory(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(size_t),
+ TCL_UNUSED(Tcl_Size),
+ TCL_UNUSED(const char *),
+ TCL_UNUSED(Tcl_LoadHandle *),
+ TCL_UNUSED(Tcl_FSUnloadFileProc **),
+ TCL_UNUSED(int))
+{
+ return TCL_ERROR;
+}
+
+#endif /* TCL_LOAD_FROM_MEMORY */
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4