Overview
| Artifact ID: | 1f466d6e80b0deef6bf2465d24ab8e8b62b69520 |
|---|---|
| Ticket: | 218530ffffffffffffffffffffffffffffffffff
dynamical linking in standalone executables |
| User & Date: | nobody on 2000-10-26 01:01:46 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 913 Bug Version: 8.0.3 SubmitDate: '1998-12-04' LastModified: '1999-04-16' Severity: LOW Status: Released Submitter: welch ChangedBy: stanton OS: Windows NT OSVersion: NT4.0 SP3 Machine: X86 FixedDate: '1999-04-16' FixedInVersion: 8.1b3 ClosedDate: '2000-10-25' Name: Jan Nijtmans CustomShell: plus-patch. But because this problem is ReproducibleScript: - produce a standalone executable on a system which doesn't support backlinking (e.g. Windows 95/98/NT). (I did this with the plus-patch, but since this problem is generic I am sure that the TclPro wrapper has the same problem) - dynamicaly load any extension (e.g. "package require Tix") ObservedBehavior: Unhandled exception. The stack trace in the above described case looks like (although I doubt it is useful) TK80! 00cafaa2() TIX4180! 10019d92() WISH80S! 0040e097() WISH80S! 0043f879() WISH80S! 0040e966() WISH80S! 0040e72f() WISH80S! 0040fc0c() WISH80S! 004133f5() WISH80S! 0041322a() WISH80S! 00413a1e() WISH80S! 0040e097() WISH80S! 0043f879() WISH80S! 0040e966() WISH80S! 0040fc3c() WISH80S! 00413103() WISH80S! 00412ff3() WISH80S! 00401941() WISH80S! 0040e097() WISH80S! 0043f879() WISH80S! 0040e966() WISH80S! 0041fbcb() WISH80S! 0043f879() WISH80S! 0040e966() WISH80S! 0040e72f() WISH80S! 0040fc0c() WISH80S! 004787f0() WISH80S! 004678fd() WISH80S! 0044bb61() WISH80S! 0044be36() WISH80S! 0041a9ff() WISH80S! 0041ac9d() WISH80S! 0044bea0() WISH80S! 004010b8() WISH80S! 00402146() KERNEL32! 77f1b304() DesiredBehavior: nice error message: "Cannot load package in statically linked executable", or something like that. The patch below is able to catch this kind of error, before anything bad happens. (The same can happen with any global variable in tcl.dll or tk.dll, but tclEmptyStringRep is the easiest to check for). I tested this on Windows NT4/SP3. Patch: *** generic/tclPkg.c.origThu Apr 02 00:39:49 1998 --- generic/tclPkg.cTue Nov 17 15:29:57 1998 *************** *** 150,155 **** --- 150,173 ---- Tcl_DString command; /* + * Test if global variables are correctly initialized. If not, + * the only explanation is that we are trying to load a binary + * package into a statically linked executable on a system + * which doesn't support backlinking (e.g. Windows, AIX). In + * that case there are two global variables "tclEmptyStringRep": + * one in the static executable and one in the shared Tcl + * library. If we are addressing the wrong one here (and that + * is what happens if we try dynamical loading), it's better + * to produce a nice error message, than having a crash later. + */ + + if (!tclEmptyStringRep) { + Tcl_AppendResult(interp, "Cannot load package \"", name, + "\" in statically linked executable", NULL); + return NULL; + } + + /* * It can take up to three passes to find the package: one pass to * run the "package unknown" script, one to run the "package ifneeded" * script for a specific version, and a final pass to lookup the PatchFiles: tclPkg.c Explanation how this solution works: If the system doesn't support backlinking, there are two global variables "tclEmptyStringRep": one in the static executable and one in the shared Tcl library. If the function Tcl_PkgRequire() (which is usually the first function in the extension) is executing in a only partly initialized dll, that is asking for trouble. On AIX it is currently impossible to do this, because --disable-load is coupled with --enable-shared. With this change, it would be possible to remove this coupling: There will still an error message be generated if the used tries to do dynamical loading. (B.T.W, it is possible to produce libraries which can be dynamically loaded on AIX in statically linked executables. Paul Duffin is working on that, with very good results) This is incorporated by the stubs patches. 04/16/1999 14:44 - stanton - - foundin changed to: "obsolete: 8.0.3"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: "dynamical linking in standalone executables"
- type changed to: "Bug"