Ticket UUID: | a55872c2429bea123139d3f2bd25182a2d6c78f7 | |||
Title: | tcl8.7 on windows: linking against stubs library is now required in 8.7 | |||
Type: | Bug | Version: | 8.7 | |
Submitter: | ralfixx | Created on: | 2022-06-20 10:37:19 | |
Subsystem: | 69. Other | Assigned To: | jan.nijtmans | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2022-06-20 15:21:30 | |
Resolution: | Fixed | Closed By: | jan.nijtmans | |
Closed on: | 2022-06-20 15:21:30 | |||
Description: |
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. | |||
User Comments: |
jan.nijtmans added on 2022-06-20 15:21:30:
Changes committed now. Thanks! ralfixx added on 2022-06-20 14:15:28: Yes, of course I can live with that ;-) jan.nijtmans added on 2022-06-20 11:59:43: Fix is really [3483c7eafdebabe8|here] (previous link just links back to this ticket....) jan.nijtmans added on 2022-06-20 11:58:19: 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 ;-) jan.nijtmans added on 2022-06-20 11:29:14: 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. oehhar added on 2022-06-20 10:45:25: Thank you, Ralf, IMHO, this is a bug. IMHO, it should work by one of:
As you report, the tcl lib is not sufficient. The stubs lib is required. Thank you, Harald |