summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-24 10:14:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-24 10:14:01 (GMT)
commitbd8b8ff3b710e8ae5f4750eadc84c9d96c3ea4c7 (patch)
tree54f85fdbd242e594fd5a28c083eb6c458e1f9ee4 /generic
parent36711a3721be3776af05af4cd109ffe58cb168f8 (diff)
downloadtcl-bd8b8ff3b710e8ae5f4750eadc84c9d96c3ea4c7.zip
tcl-bd8b8ff3b710e8ae5f4750eadc84c9d96c3ea4c7.tar.gz
tcl-bd8b8ff3b710e8ae5f4750eadc84c9d96c3ea4c7.tar.bz2
Final implementation tweaks, fix comments, allow Tcl to load from <prefix>/lib (or <prefix>/bin on win32/cygwin) even when this is not in your PATH.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclStubCall.c22
-rw-r--r--generic/tclStubLib.c2
-rw-r--r--generic/tclStubLibTbl.c2
3 files changed, 20 insertions, 6 deletions
diff --git a/generic/tclStubCall.c b/generic/tclStubCall.c
index 8fe7892..96e3837 100644
--- a/generic/tclStubCall.c
+++ b/generic/tclStubCall.c
@@ -59,7 +59,7 @@ static const char CANNOTFIND[] = "Cannot find %s: %s\n";
MODULE_SCOPE void *
TclStubCall(void *arg)
{
- static void *stubFn[] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL};
+ static void *stubFn[] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
unsigned index = PTR2UINT(arg);
if (index >= sizeof(PROCNAME)/sizeof(PROCNAME[0])) {
@@ -76,12 +76,26 @@ TclStubCall(void *arg)
}
if (!stubFn[index]) {
if (!tclStubsHandle) {
- tclStubsHandle = dlopen(TCL_DLL_FILE, RTLD_NOW|RTLD_LOCAL);
+ tclStubsHandle = dlopen(CFG_RUNTIME_DLLFILE, RTLD_NOW|RTLD_LOCAL);
+ if (!tclStubsHandle) {
+ tclStubsHandle = dlopen(
+#if defined(_WIN32) || defined(__CYGWIN__)
+ CFG_RUNTIME_BINDIR
+#else
+ CFG_RUNTIME_LIBDIR
+#endif
+#if defined(_WIN32)
+ "\\"
+#else
+ "/"
+#endif
+ CFG_RUNTIME_DLLFILE, RTLD_NOW|RTLD_LOCAL);
+ }
if (!tclStubsHandle) {
if ((index == 0) && (arg != NULL)) {
- ((Tcl_PanicProc *)arg)(CANNOTFIND, TCL_DLL_FILE, dlerror());
+ ((Tcl_PanicProc *)arg)(CANNOTFIND, CFG_RUNTIME_DLLFILE, dlerror());
} else {
- fprintf(stderr, CANNOTFIND, TCL_DLL_FILE, dlerror());
+ fprintf(stderr, CANNOTFIND, CFG_RUNTIME_DLLFILE, dlerror());
abort();
}
}
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 32ca1f1..697d92f 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -109,7 +109,7 @@ Tcl_InitStubs(
stubsPtr = (TclStubs *)pkgData;
}
if (tclStubsHandle == NULL) {
- tclStubsHandle = (void *) -1;
+ tclStubsHandle = INT2PTR(-1);
}
tclStubsPtr = stubsPtr;
diff --git a/generic/tclStubLibTbl.c b/generic/tclStubLibTbl.c
index 32b3869..ad34494 100644
--- a/generic/tclStubLibTbl.c
+++ b/generic/tclStubLibTbl.c
@@ -40,7 +40,7 @@ TclInitStubTable(
if (tclStubsHandle == NULL) {
/* This can only happen with -DBUILD_STATIC, so simulate
* that the loading of Tcl succeeded, although we didn't
- * actually loaded it dynamically */
+ * actually load it dynamically */
tclStubsHandle = (void *)1;
}
tclStubsPtr = ((const TclStubs **) version)[-1];