Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d9c0c56a5c4eab439477d68acb27a349ed66178d
Ticket: 1104873fffffffffffffffffffffffffffffffff
missing TCL_STORAGE_CLASS ?
User & Date: mjdonahue on 2005-02-02 10:58:21
Changes

  1. icomment:
    Logged In: YES 
    user_id=1210132
    
    There are two issues here.
    
    ISSUE 1:  Currently, the Tcl_PackageInitProc typedef is
    
       typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp
    *interp));
    
    I suggest that this is incorrect, and should more properly be
    
       typedef TCL_STORAGE_CLASS int (Tcl_PackageInitProc)
    _ANSI_ARGS_((Tcl_Interp *interp));
    
    Referring to the URL mentioned by davygrvy,
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
    vccelng/htm/msmod_17.asp, the full sentence reads:
    
    Unlike the __near and __far keywords, which actually affect
    the type of object or function (in this case, 2- and 4-byte
    addresses), these storage-class attributes do not redefine
    the type attributes of the object itself.
    
    The reference here is to a particular subset of __declspec
    modifiers (including dllimport and dllexport).  This would
    appear to imply that other storage-class attributes may
    redefine the type attribute.  For this reason, I believe
    that TCL_STORAGE_CLASS should be included in the
    Tcl_PackageInitProc typedef.  Currently, TCL_STORAGE_CLASS
    is defined to be either empty or
    __declspec(dllimport/dllexport).  Either way, this shouldn't
    affect the type attribute (as pointed out by davygrvy), so
    this change shouldn't break anything.
    
    ISSUE 2: The Open Watcom compiler uses by default a
    different calling convention than Microsoft VC.  Open Watcom
    does support the VC calling convention, but you have to
    specify when a function is using that convention.  This does
    change the type attribute, so it seems sensible to put that
    information into the TCL_STORAGE_CLASS macro.  I am
    uncertain as to the best way to do this, but I find that if
    I put
    
       __declspec(__cdecl)
    
    into TCL_STORAGE_CLASS, then along with the change suggested
    in ISSUE 1 above, I can successfully link code compiled with
    Open Watcom against a Tcl DLL built with VC.  Of course,
    this is a Watcom specific extension, so it should be wrapped
    with #if defined(__WATCOMC__) guards.  This seems reasonable
    given the compiler-specific code already in the
    DLLIMPORT/DLLEXPORT definitions.
    
    Actually, I need __declspec(__cdecl) to link against
    anything in the Tcl DLL's.  Making only this change my code
    builds completely *except* for the problem addressed in
    ISSUE 1, which looks like a bug to me regardless of whether
    one wants to add Watcom support.  ISSUE 2 is clearly a
    Watcom compiler specific matter.
    
    
    
  2. login: "mjdonahue"
  3. mimetype: "text/plain"
  4. username: "mjdonahue"