Tcl Source Code

View Ticket
Login
Ticket UUID: 2282547
Title: load of ill-behaved shared library from VFS: core dump
Type: Bug Created on: 2008-11-14 09:04:31
Submitter: jan.nijtmans Assigned to: jan.nijtmans
Subsystem: 40. Dynamic Loading Severity:
Priority: 3 Low Last modified: 2026-10-12 18:37:33
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.6a4
Description:
I cannot imagine that anyone would require that, but
still it is a current problem.

Fixing Bugs [2059262] and [2269431] leads to the
following conflict. When unloading a shared library
wen Tcl exists we have two choices. We can leave
it to the OS, as Tcl 8.4 did, or we can force
unloading at TclFinalize time, as Tcl 8.5 did.

The method in Tcl 8.4 had the disadvantage that
shared libraries cannot be loaded from VFS, that's
why it was changed in Tcl 8.5. However, this
introduced Bug [2059262]. Fixing this introduced
Bug [2269431]. Both bugs are fixed now, simply
by checking if the library comes from the native
file system not. If so, we let the OS handle the
unloading, otherwise we force unloading at
TclFinalize time. Libraries which have an UnLoad
proc use the second method as well.

However, I think there is a way out of this,
therefore this new (lower-priority) artifact.
User Comments:
serhiy.storchaka added on 2026-10-12 18:37:33:

Since [80aa157f45] (TIP #357), TclFinalizeLoad() unloads all non-static libraries, from VFS or not, when Tcl is built with TCL_UNLOAD_DLLS (always on Windows, configure option --enable-dll-unloading on Unix). Ill-behaved libraries require building with --disable-dll-unloading. On Unix the temporary copy of a library loaded from VFS is deleted right after loading, so it does not need to be unloaded.