Menu

#55 Issues with tcl::initlib

open
nobody
None
5
2015-03-28
2015-03-28
No

The tls::initlib proc does a whole song and dance to copy some non-existing dlls out of the package directory in case it's wrapped. This has the following issues:

  • Even though the comment says that cd'ing is irrelevant to unixoids, it's not in a threaded application.
  • On windows the code tries to access $starkit::topdir. However that variable doesn't get set unless [starkit::startup] is called.
  • The error caused by starkit::topdir not being set prevents the [cd $cwd] from running, so the user ends up in a different directory to where he started from.

I'm not a windows user myself, but I have distributed starpacks for windows with tls that didn't include any openssl dlls for years. I have never received any reports from users that they got errors when using tls. So it seems these magical dlls it is trying to copy out are not even necessary, at least not for normal use.

So I suggest to simplify tls::initlib to:

:::tcl
proc tls::initlib {dir dll} {
    set res [catch {uplevel #0 [list load [file join $dir $dll]]} err]
    if {$res} {
        namespace eval [namespace parent] {namespace delete tls}
        return -code $res $err
    }
    rename tls::initlib {}
}

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.