|
2022-06-20
| ||
| 15:21 | • Closed ticket [a55872c242]: tcl8.7 on windows: linking against stubs library is ... artifact: e6c0d7fce9 user: jan.nijtmans | |
| 15:20 | Fix [a55872c242]: tcl8.7 on windows: linking against stubs library is now required in 8.7. No longer... check-in: d7052c5f73 user: jan.nijtmans tags: core-8-branch | |
| 14:15 | • Ticket [a55872c242] tcl8.7 on windows: linking against stubs library is now requ... artifact: cff325ddad user: ralfixx | |
| 11:59 | • Ticket [a55872c242]: 3 changes artifact: 229d1b36af user: jan.nijtmans | |
| 11:58 | • Pending ticket [a55872c242]. artifact: efd0e3ab13 user: jan.nijtmans | |
| 11:55 | Fix [a55872c242]: tcl8.7 on windows: linking against stubs library is now required in 8.7. If the Tc... closed check-in: 3483c7eafd user: jan.nijtmans tags: bug-a55872c242 | |
| 11:29 | • Ticket [a55872c242] tcl8.7 on windows: linking against stubs library is now requ... artifact: bb3744b19b user: jan.nijtmans | |
| 10:45 | • Ticket [a55872c242]: 4 changes artifact: 939cf3e827 user: oehhar | |
| 10:37 | • New ticket [a55872c242]. artifact: 6999bb2960 user: ralfixx | |
tcl8.7 on windows: linking against stubs library is now required in 8.7
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.
d7052c5f73Fix [a55872c242]: tcl8.7 on windows: linking against stubs library is now required in 8.7. No longer required now (with this change) if the Tcl lib is static. check-in2022-06-20 15:20:13efd0e3ab13Pending ticket [a55872c242]: tcl8.7 on windows: linking against stubs library is now required in 8.7 plus 4 other changes ticket2022-06-20 11:58:193483c7eafdFix [a55872c242]: tcl8.7 on windows: linking against stubs library is now required in 8.7. If the Tcl library is static (.lib/.a) then the stub library is (with this fix) no longer necessary. If the Tcl library is a dll, document that the stub library is now necessary. check-in2022-06-20 11:55:29
Thank you, Ralf,
IMHO, this is a bug. IMHO, it should work by one of:
- static build
- link to tcl lib
- link to tcl stubs lib
As you report, the tcl lib is not sufficient. The stubs lib is required.
Thank you, Harald
This change is due to TIP #425. Tcl_ConsolePanic() needs to be static, because the panicproc could - theoretically - be called even after bringing down tcl.dll. The only way I see to fulfill this requirement is putting Tcl_ConsolePanic() in the stub library, then we are sure it is linked statically in the executable so it will always be available.
If the Tcl library is static, the stub library should not be necessary. That's fixed [here]. If the Tcl library is a dll, I don't see a solution without the stub library. So, documented that now.
Ralf, can you live with that ;-)
Fix is really [here] (previous link just links back to this ticket....)
Yes, of course I can live with that ;-)
Changes committed now. Thanks!