Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 48e65009e5300e619e65a5969a5480797b5b071d
Ticket: 3588687fffffffffffffffffffffffffffffffff
Tcl_InitStubs() Broken As Designed
User & Date: nijtmans on 2012-12-07 15:26:34
Changes

  1. icomment:
    >we agree that
        Tcl_InitStubs(interp, "8.6-", 0)
    >is *never* a sensible thing to do, right
    
    On 64-bit platforms we agree on that, but
    on 32-bit platforms I see no problem.
    
    > Compiling against Tcl 8 headers, but passing
    > "9.0" as an argument to Tcl_InitStubs() cannot ever
    > work and is always a mistake.)
    There is no reason at all to do that: It can only work
    when the extension uses the common subset of
    Tcl 8.6 and 9.0 API's, but then it makes no sense
    to specify "9.0". Specifying "8.6-" would make more sense.
    
    
    The consensus should be:
        Tcl_InitStubs(interp, "8.6", 0)
    means that this extension uses the 8.6 API, so compiles and
    runs with any 8.x release with x >= 6.
        Tcl_InitStubs(interp, "9.0", 0)
    means that this extension uses the 9.0 API, so compiles and
    runs with any 9.x release.
        Tcl_InitStubs(interp, "8.6-", 0)
    means that when compiled with Tcl 8.6 headers it will run with
    Tcl 8.6, and when compiled with Tcl 9.0 headers it will run
    with any 9.x release. In Tcl9 some API's will be removed,
    others will be added. Any extension specifying "8.6-" can
    only use the common subset API's of 8.6 and 9.0. (
    assuming the stub entrie positions are kept equal)
    
    This also means that no extension can claim "8.6-"
    during the alpha/beta period of Tcl 9. One method
    to enforce that is in tcl.h 9.0 specifying:
    #if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
    #define Tcl_InitStubs(interp, version, exact) \
        TclInitStubs(interp, version, exact, TCL_VERSION, TCL_STUB_MAGIC)
    else
    #define Tcl_InitStubs(interp, version, exact) \
        TclInitStubs(interp, TCL_PATCH_LEVEL, 1, TCL_VERSION, TCL_STUB_MAGIC)
    #endif
    
    But - as proven - claiming "8.6-" compatibility cannot ever work
    across the 8.6/9.0 border on 64-bit platforms. That's what the
    MAGIC change is needed for.
    
    Regards,
              Jan Nijtmans
    
    
  2. login: "nijtmans"
  3. mimetype: "text/plain"
  4. username: "nijtmans"