Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4b03914640c546fd47b9185492cf366b3ecde8455bb61425e300c1817e884ede
Ticket: a998df01f3256f79f4d7d635517130012b4001f5
Attempt to load platform package in a pkgIndex.tcl generates circular dependency error
User & Date: dkf on 2022-07-05 09:01:44
Changes

  1. icomment:
    I'd construct the <code>pkgIndex.tcl</code> like this:
    <pre>
    package ifneeded testpkg 0.1 [list apply {{dir} {
        package require platform
        set plat [platform::identify]
        set ext [info sharedlibextension]
        uplevel 1 [list load [file join $dir $plat mybinaryextension.$ext]]
    }} $dir]
    </pre>
    The <code>uplevel 1</code> wrapper is, of course, hyper-correctness that only a few C packages would ever need. You could probably get away with:
    <pre>
    package ifneeded testpkg 0.1 [list apply {{dir} {
        package require platform
        set plat [platform::identify]
        set ext [info sharedlibextension]
        load [file join $dir $plat mybinaryextension.$ext]
    }} $dir]
    </pre>
    As you can see, this gives you local variables and simple substitution rules without needing an extra command. (It's only a problem if you want to support 8.4 and before, but that's out of all support now...)
    
  2. login: "dkf"
  3. mimetype: "text/html"