• tcl8.7 on windows: linking against stubs library is now required in 8.7

    From Ralf Fassel@21:1/5 to All on Thu Jun 16 20:11:14 2022
    Taking the minimal tclsh example from
    https://wiki.tcl-lang.org/page/Building+a+custom+tclsh
    /* t.c */
    #include <tcl.h>
    int AppInit(Tcl_Interp *interp) {
    if(Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;
    Tcl_SetVar(interp,"tcl_rcFileName","~/.wishrc",TCL_GLOBAL_ONLY);
    return TCL_OK;
    }
    int main(int argc, char *argv[]) {
    Tcl_Main(argc, argv, AppInit);
    return 0;
    }
    /* End of file */

    Linking on windows now requires linking against the TCL stubs library in
    8.7, where this was not required in 8.6.

    This is due to a change in the Tcl_Main macro on windows, which now
    includes a call to Tcl_SetPanicProc(Tcl_ConsolePanic) in tcl.h:

    #define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \
    ((Tcl_SetPanicProc(Tcl_ConsolePanic), Tcl_CreateInterp)()))

    where 'Tcl_ConsolePanic' is #defined NULL on Linux, but a real function
    on Windows, which is only available in the stubs library.

    Linking against 8.7:
    $ cl /nologo /Fet.exe t.c -Itcltk87/include tcltk87/lib/tcl87.lib
    t.c
    t.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "Tcl_ConsolePanic" in Funktion "main".
    t.exe : fatal error LNK1120: 1 nicht aufgelöste Externe

    adding tcltk87/lib/tclstub87.lib to the link line => success.
    $ cl /nologo /Fet.exe t.c -Itcltk87/include tcltk87/lib/tcl87.lib tcltk87/lib/tclstub87.lib
    t.c
    => success

    Linking against 8.6:
    $ cl /nologo /Fet.exe t.c -Itcltk86/include tcltk86/lib/tcl86.lib
    t.c
    => success

    Not sure if this was intentional, but it probably should be documented
    in the Tcl_Main manpage, which already reads

    Programs that call Tcl_Main must be linked
    against the standard Tcl library.

    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Jun 17 08:55:58 2022
    Am 16.06.2022 um 20:11 schrieb Ralf Fassel:
    Taking the minimal tclsh example from
    https://wiki.tcl-lang.org/page/Building+a+custom+tclsh
    /* t.c */
    #include <tcl.h>
    int AppInit(Tcl_Interp *interp) {
    if(Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;
    Tcl_SetVar(interp,"tcl_rcFileName","~/.wishrc",TCL_GLOBAL_ONLY);
    return TCL_OK;
    }
    int main(int argc, char *argv[]) {
    Tcl_Main(argc, argv, AppInit);
    return 0;
    }
    /* End of file */

    Linking on windows now requires linking against the TCL stubs library in
    8.7, where this was not required in 8.6.

    This is due to a change in the Tcl_Main macro on windows, which now
    includes a call to Tcl_SetPanicProc(Tcl_ConsolePanic) in tcl.h:

    #define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \
    ((Tcl_SetPanicProc(Tcl_ConsolePanic), Tcl_CreateInterp)()))

    where 'Tcl_ConsolePanic' is #defined NULL on Linux, but a real function
    on Windows, which is only available in the stubs library.

    Linking against 8.7:
    $ cl /nologo /Fet.exe t.c -Itcltk87/include tcltk87/lib/tcl87.lib
    t.c
    t.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "Tcl_ConsolePanic" in Funktion "main".
    t.exe : fatal error LNK1120: 1 nicht aufgelöste Externe

    adding tcltk87/lib/tclstub87.lib to the link line => success.
    $ cl /nologo /Fet.exe t.c -Itcltk87/include tcltk87/lib/tcl87.lib tcltk87/lib/tclstub87.lib
    t.c
    => success

    Linking against 8.6:
    $ cl /nologo /Fet.exe t.c -Itcltk86/include tcltk86/lib/tcl86.lib
    t.c
    => success

    Not sure if this was intentional, but it probably should be documented
    in the Tcl_Main manpage, which already reads

    Programs that call Tcl_Main must be linked
    against the standard Tcl library.

    HTH
    R'

    Ralf,

    I would post a TCL ticket to have the discussion at the right place.
    I suppose, this is an unintended side effect.
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Mon Jun 20 12:38:38 2022
    * Harald Oehlmann <wortkarg2@yahoo.de>
    | Am 16.06.2022 um 20:11 schrieb Ralf Fassel:
    --<snip-snip>--
    | > Linking on windows now requires linking against the TCL stubs library in
    | > 8.7, where this was not required in 8.6.
    --<snip-snip>--

    | I would post a TCL ticket to have the discussion at the right place.
    | I suppose, this is an unintended side effect.

    [x] done

    https://core.tcl-lang.org/tcl/tktview/a55872c2429bea123139d3f2bd25182a2d6c78f7

    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)