Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f36360d44734bedcf74dca369605eed7be15a298
Ticket: 3588687fffffffffffffffffffffffffffffffff
Tcl_InitStubs() Broken As Designed
User & Date: nijtmans on 2012-12-07 02:02:36
Changes

  1. icomment:
    The value of a separate tclStubLibCompat.c is, that it can be left
    out when the stub library is linked using Tcl 9 headers. I am trying
    to reach the goal of a version-independant stub library, the difference
    is in tcl.h only.
    
    The minimum requirement of Tcl_PkgRequireEx to work is that:
    - the entry in the stub table stays the same
    - the signature of Tcl_PkgRequireEx stays the same.
    I see no reason to change the entry or the signature,
    so there is no magic check needed to make it work for
    sure. The additional checks are meaningless IMHO.
    
    The real problem is the signature change in other
    functions, which are not used in the stub library,
    such as Tcl_EvalEx(). Or in the Tcl_Obj structure,
    which will (I assume) change the length field
    from int to size_t. On 32-bit platforms that doesn't
    make a difference (all those types are 32-bit) but
    on 64-bit platforms it totally breaks. Therefore I
    propose to change the magic value from
         (int) 0xFCA3BACF
    to
         (int) (0xFCA3BACB + sizeof(size_t))
    Then the magic value on 32-bit platforms stays
    the same, on 64-bit platforms it changes. Then
    the current check suffices to detect the problem.
    
    So, I agree with you - as you stated earlier:
    >Since I'd prefer not to change the TCL_STUBS_MAGIC value
    I prefer not to change the TCL_STUBS_MAGIC
    as well. But striving for a version-independant
    stub library, on 64-bit platforms I don't see
    another possibility. On 32-bit platforms I
    don't see a reason to change it.
    
    
  2. login: "nijtmans"
  3. mimetype: "text/plain"
  4. username: "nijtmans"