Skip to content
Tcl Source Code History Of Ticket 1104873
Login

History Of Ticket 1104873

Artifacts Associated With Ticket 1104873

  1. Ticket change [6653b2e6e9] (rid 102693) by dgp on 2005-01-18 23:02:04:

    1. assignee initialized to: "davygrvy"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      When #include-ing both tcl.h and tk.h,
      a colleague notices this apparently
      inconsistent set of declarations:
      
      ...
      
        #ifdef __cplusplus
        #   define EXTERN extern "C" TCL_STORAGE_CLASS
        #else
        #   define EXTERN extern TCL_STORAGE_CLASS
        #endif
      
      ...
      
        typedef int (Tcl_PackageInitProc)
                     _ANSI_ARGS_((Tcl_Interp *interp));
      
      ...
      
        EXTERN void Tcl_StaticPackage 
                   _ANSI_ARGS_((Tcl_Interp * interp, 
                   char * pkgName, Tcl_PackageInitProc *
      initProc, 
                   Tcl_PackageInitProc * safeInitProc));
      
      ...
      
         EXTERN int Tk_Init _ANSI_ARGS_((Tcl_Interp * interp));
         EXTERN int Tk_SafeInit _ANSI_ARGS_((Tcl_Interp *
      interp));
      
      
      Colleague claims this inconsistency shows up
      when the Watcom compiler tries to compile
      
        Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
      
      with complaints of a type mismatch between
      what Tcl_StaticPackage expects and what
      the Tk_*Init routines are declared to be.
      
      Further claim is that all would be well if the
      Tcl_PackageInitProc typedef were changed to:
      
          typedef TCL_STORAGE_CLASS 
                     int (Tcl_PackageInitProc)
                     _ANSI_ARGS_((Tcl_Interp *interp));
      
      I don't buy it; but I also don't understand this
      mess well enough to explain what might be
      wrong with his proposal.  Help?
      
    4. foundin initialized to: "obsolete: 8.4.9"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dgp"
    9. subsystem initialized to: "53. Configuration and Build Tools"
    10. title initialized to: "missing TCL_STORAGE_CLASS ?"
    11. type initialized to: "Bug"
  2. Ticket change [05c2918ab4] (rid 89114) by davygrvy on 2005-01-19 14:01:09:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      putting TCL_STORAGE_CLASS in the typedef isn't a bad idea,
      actually.  Yes, it's messy stuff.
      
      Trouble is, whether the function is being exported,
      imported, or have a static association _should_ have no
      bearing on the usage...
      
      What I find odd is that Tcl_StaticPackage is mentioned, but
      is he importing the Tk_*Init symbols??  That's strange.. 
      Did he forget to set the -DSTATIC_BUILD macro?
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  3. Ticket change [5b79d825a3] (rid 118334) by dgp on 2005-01-19 22:37:16:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      Ah.  Maybe we're getting somewhere.
      
      Where can I read about this
      STATIC_BUILD and when
      and how it should be used?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [beb247dcbb] (rid 102121) by dgp on 2005-01-25 01:43:04:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      FWIW, it appears the STATIC_BUILD
      setting has no impact on non-Windows
      systems.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [abf20fdd66] (rid 101205) by dgp on 2005-01-25 01:46:02:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      Haven't got a report back yet,
      but I don't see how setting
      -DSTATIC_BUILD is going
      to help resolve the conflicting
      calling conventions of the 
      two compilers.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [649a713fbf] (rid 92796) by davygrvy on 2005-01-26 11:24:36:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      1) The watcom compiler *IS* a windows (and DOS) compiler.
      
      2) When building projects that include tcl.h as a client
      (aka building a custom shell), the default storage class is
      for import from the DLL (tcl84.dll).  By defining
      STATIC_BUILD the storage class becomes empty as when one
      will link with tcl84s.lib (the static library).
      
      Is your colleague targeting for tcl84s.lib (the static) or
      tcl84.lib (the export)?  If he is targeting for tcl84s.lib
      (the static), then do compile with -DSTATIC_BUILD or the
      linker will become confused.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  7. Ticket change [074884e67e] (rid 89366) by dgp on 2005-01-26 21:41:33:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      To my knowledge, there is not
      file tcl84s.lib distributed as
      part of ActiveTcl, so he's trying
      to link against the import
      library tcl84.lib.  He does
      succeed in the link, but had
      to make changes regarding
      TCL_STORAGE_CLASS to
      get the compile to go, I think.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [b50fbd984d] (rid 125176) by davygrvy on 2005-01-28 00:48:59:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      Sounds like Watcom doesn't view a prototype with an import
      attribute to be equal to one with.  Does where it come from
      really make it part of the signature?
      
      Are we going to have to go back to .def files or what?  VC++
      doesn't get confused by this.  Sounds like a compiler bug.
      
      __declspec(__dllimport) int foo (int a);
      int bar (int a);
      
      The sigs for type comparison are identical.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  9. Ticket change [1b82126d24] (rid 123165) by davygrvy on 2005-01-28 00:56:16:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      As per
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/msmod_17.asp:
      "
      ....storage-class attributes do not redefine the type
      attributes of the object itself.
      "
      
      Still seems like a Watcom compiler bug to me.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  10. Ticket change [75c9fa9cff] (rid 105447) by davygrvy on 2005-01-28 01:01:13:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      This might be related:
      http://bugzilla.openwatcom.org/show_bug.cgi?id=35
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  11. Ticket change [d9c0c56a5c] (rid 107663) by mjdonahue on 2005-02-02 10:58:21:

    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"
  12. Ticket change [19f70e0de0] (rid 122894) by davygrvy on 2005-02-02 16:40:10:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      I'll have a look at adding __cdecl.  It shouldn't be hard to do.
      It sort-of is implicit, but nothing is wrong with explicity
      except that our protos will get more wordy than they already
      are..  There might be a WATCOM specific #pragma to fix it
      globally..  I'll have a look.
      
      Thanks for the detail.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  13. Ticket change [a025986816] (rid 96753) by dgp on 2005-02-02 21:35:15:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      Is there any explanation for why
      the watcom compiler complains
      about the combination of
      Tcl_StaticPackage / Tcl_PackageInitProc
      but allows the combination of
      Tcl_CreateCommand / Tcl_CmdProc ?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  14. Ticket change [d5f8bd356b] (rid 123726) by mjdonahue on 2005-02-03 10:54:28:

    1. icomment:
      Logged In: YES 
      user_id=1210132
      
      The watcom compiler complained about
      Tcl_StaticPackage/Tcl_PackageInitProc but not
      Tcl_CreateCommand/Tcl_CmdProc because Tk_Init was used as an
      argument to Tcl_StaticPackage, and Tk_Init is declared
      elsewhere in the Tk header files with a different type.
      
      However, on reflection, I think all the Tcl_*Proc typedef's
      should include some storage class info.  The watcom compiler
      didn't complain about these because these typedefs are not
      being applied to functions declared inside the Tcl library,
      but rather to user code.  But, the Tcl library is going to
      make calls into these functions, and it was built with
      certain assumptions about the calling convention for these
      user defined functions.  So it seems that information should
      be included in all the Tcl_*Proc typedefs.
      
      Maybe one shouldn't use the TCL_STORAGE_CLASS macro here,
      since these are functions outside the Tcl library, but
      instead define a new macro, something like
      FOREIGN_STORAGE_CLASS.  This new macro would *not* include
      the dllimport/dllexport qualifiers found in
      TCL_STORAGE_CLASS, but would include things like cdecl.  In
      this regard, check out the comment preceding the definition
      of Tcl_AppInit near the bottom of tcl.h.
      
      
    2. login: "mjdonahue"
    3. mimetype: "text/plain"
    4. username: "mjdonahue"
  15. Ticket change [84404059bd] (rid 117515) by davygrvy on 2005-11-04 04:55:56:

    1. assignee changed to: "patthoyts"
  16. Ticket change [6f36d280ea] (rid 100276) by dgp on 2006-11-23 02:49:34:

    1. assignee changed to: "jenglish"
  17. Ticket change [3286c297d4] (rid 93628) by jenglish on 2008-02-24 00:11:00:

    1. closedate changed to: "2008-02-23T17:11:00"
    2. closer changed to: "jenglish"
    3. icomment:
      Logged In: YES 
      user_id=68433
      Originator: NO
      
      "typedef TCL_STORAGE_CLASS int (Tcl_PackageInitProc)(Tcl_Interp *interp);" would be incorrect for the standard definition of TCL_STORAGE_CLASS on all supported platforms (MSVC, GCC on Windows, and for all non-Windows platforms where TCL_STORAGE_CLASS is simply "extern".)
      
      If any Watcom users can suggest a solution that's compatible with Tcl's "officially-supported" compiler/platform combinations, it's worth considering, but this isn't it.
      
      
    4. login: "jenglish"
    5. mimetype: "text/plain"
    6. resolution changed to: "Rejected"
    7. status changed to: "Closed"
    8. username: "jenglish"