Artifacts Associated With Ticket 290bfe463c
Ticket change [4c359eb069] (rid 248727) by oehhar on 2025-11-25 10:25:28:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
This wiki page [https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9&p] states: "Tcl_Size" itself doesn't need to be provided as long as you update the extension to the latest tclconfig release. TEA (latest tcl.m4/rules.vc files) takes care of providing an appropriate preprocessor #define for Tcl_Size. I tried this to comply to this ticket [https://github.com/tcltk-depot/tksvg/issues/27]. I replaced TkSizeT by Tcl_Size. The compilation using makefile.vc and MS-VC6 32 bit on MS-Win 11 64 bit states: <verbatim> C:\test\git\tksvg\win\..\generic\tkImgSVG.c(93) : error C2146: syntax error : missing ')' before identifier 'length' C:\test\git\tksvg\win\..\generic\tkImgSVG.c(93) : error C2081: 'Tcl_Size' : name in formal parameter list illegal </verbatim> I looked, if Tcl_Size is given by a define as stated by the wiki page. The compiler invocation has no "-D Tcl_Size". <verbatim> cl -nologo -c /D_ATL_XP_TARGETING /DHAVE_CPUID=1 -W3 -wd4090 -wd4146 -FpC:\test\git\tksvg\win\Release\tksvg_ThreadedDynamic\ -Op -QI0f -O2 -YX -MD -I"C:\test\tcl8.6.17\tcl8.6.17\generic" -I"C:\test\tcl8.6.17\tcl8.6.17\win" -I"C:\test\tcl8.6.17\tk8.6.17\generic" -I"C:\test\tcl8.6.17\tk8.6.17\win" -I"C:\test\tcl8.6.17\tk8.6.17\xlib" -I"C:\test\git\tksvg\win\..\generic" -I"C:\test\git\tksvg\win\..\win" -I"C:\test\git\tksvg\win\..\compat" -Dinline=__inline /DSTDC_HEADERS /DUSE_NMAKE=1 /DMP_NO_STDINT=1 /DTCL_THREADS=1 /DUSE_THREAD_ALLOC=1 /DNDEBUG /DTCL_CFG_OPTIMIZED /DNO_STRTOI64=1 /DUSE_TCL_STUBS /DUSE_TCLOO_STUBS /DUSE_TK_STUBS /DPACKAGE_NAME="\"tksvg\"" /DPACKAGE_TCLNAME="\"tksvg\"" /DPACKAGE_VERSION="\"0.15\"" /DMODULE_SCOPE=extern /DBUILD_tksvg -FoC:\test\git\tksvg\win\Release\tksvg_ThreadedDynamic\ @C:\Users\oehhar\AppData\Local\Temp\nmc09512. </verbatim> So, how should this work ? Paul wrote, that the "Tcl_Size Magic Code" has to be integrated. This code is: <verbatim> #ifndef TCL_SIZE_MAX #include <limits.h> #define TCL_SIZE_MAX INT_MAX #ifndef Tcl_Size typedef int Tcl_Size; #endif #define TCL_SIZE_MODIFIER "" #define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj #endif </verbatim> Why is this not stated on the wiki page? Thanks for all, Harald - foundin initialized to: "8.6.17"
- is_private initialized to: "0"
- login: "oehhar"
- priority initialized to: "5 Medium"
- private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "oehhar"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
Define for Tcl_Size not present when compiling against Tcl 8.6.17
- type initialized to: "Bug"
Ticket change [848573fbd6] (rid 248730) by apnadkarni on 2025-11-25 10:38:20:
- icomment:
It was stated on the Wiki page at one point. It was explicitly removed in [this](https://core.tcl-lang.org/tcl/wdiff?id=05026d7c0e) edit. Personally, I still believe defining `Tcl_Size` in configure/rules makes no sense as you still have to define others (`TCL_SIZE_MODIFIER`, `TCL_SIZE_MAX` etc.) in the extension. But it is what it is given others feel otherwise ... You may possibly need to update your tclconfig.
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [70bac93e17] (rid 248731) by oehhar on 2025-11-25 10:52:58:
- icomment:
Ashok, thanks for hte answer. I have updated the tclconfig as stated by the wiki page. To my understanding, tclconfig is irrelevant for win\Makefile.vc It just does not work, sorry. I don't care about tclconfig. It is over-complicated for my head, sorry. TIP 723 also requires TCL config magic for Linux, which will probably block the TIP for a long time.... Take care, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [f396248d67] (rid 248791) by apnadkarni on 2025-11-26 05:13:23:
- icomment:
Harald, I was primarily answering your question "Why is this not stated on the wiki page?" in that it was stated at one time but removed in the commit I linked by Jan, presumably because he thought it was not needed. I only pointed to tclconfig because of the advice added (in that page) suggested updating tclconfig would fix such issues. FWIW, I use boilerplate similar Paul's in all my extensions.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [3daab059c2] (rid 248793) by oehhar on 2025-11-26 08:10:23:
- icomment:
Thanks for the clarification. So, to resume: * Tcl_Size is eventually defined by "-DTclSize=int" when using the tclconfig build method * Tcl_Size is undefined with the Makefile.vc method * The code by Paul is the right way to go on Makefile.vc So, the wiki page should be updated to reflect this. It is a pity, that the two build methods are incompatible, but that is life. Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [b82bba5eed] (rid 249357) by jan.nijtmans on 2025-12-09 09:42:39:
- icomment:
The makefile.vc build set's Tcl_Size as well. See [https://core.tcl-lang.org/tcl/file?name=win/rules.vc&ci=86c9be4d804ad42f&ln=1538|this] line. So, it should be enough for extensions to update "rules.vc" to the latest version, then it should work for any platform.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [37e1142420] (rid 249358) by jan.nijtmans on 2025-12-09 09:52:13:
- assignee changed to: "hoehlmann"
- closedate changed to: "2461018.91126852"
- closer changed to: "jan.nijtmans"
- icomment:
I see why it doesn't work with tksvg: tksvg doesn't distribute its own "rules.vc", so the one distributed with Tcl is used. The "rules.vc" distributed with Tcl 8.6 doesn't set Tcl_Size. So, an alternative solution for tksvg would be to supply the latest "rules.vc" in the /win directory. Then it doesn't have to take care about Tcl_Size any more. It's just a choice, the current solution is OK too :-)
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [67b510b8f0] (rid 249359) by oehhar on 2025-12-09 09:54:28:
- assignee changed to: "nobody"
- closer changed to: "nobody"
- icomment:
Ja, thanks for the answer ! My TCL version was 8.6.15. This line has a condition to only work until TCL 8.6. <verbatim> !if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 cflags = $(cflags) -DTcl_Size=int !endif </verbatim> So, I don't think, this line would help. Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "None"
- status changed to: "Open"
- username: "oehhar"
Ticket change [8c528b9295] (rid 249360) by oehhar on 2025-12-09 09:56:16:
- icomment:
Sorry, stupid comment. I may retest. I will recheck. I don't know how to get the rules.vc. What I understood is, that it is taken from TCL and my TCL is 8.6.15. Should it be in there? Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [08130ea76e] (rid 249361) by oehhar on 2025-12-09 10:13:45:
- icomment:
Thanks, I just want to make it right. I followed the wiki and it failed. If this failure is intendet that this failure should be noted on the migration wiki page (intended not to work if not own rules.vc distributed). Is it really desired to distribute the own "rules.vc"? I thought, we have overcome this to get automatically enhancements from TCL into extensions. Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [a89f63571e] (rid 249362) by oehhar on 2025-12-09 10:37:41:
- icomment:
The discussion was probably done before. Why is Tcl_Size not defined by tcl.h also in 8.6? I prefer a typedef instead of a #define. The compiler may do better checks and it is more transparent what is happening. Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [241f6e0129] (rid 249387) by apnadkarni on 2025-12-10 06:17:03:
- icomment:
> Is it really desired to distribute the own "rules.vc"? Generally, no. There are two reasons for one's own rules.vc - - you want extensions to be able to build against older (pre 8.6.10 I think) version of Tcl - you are using rules.vc features available in newer versions of Tcl, (say 8.6.17) but building against an older Tcl whose rules.vc does not have that feature. I am not sure when the `Tcl_Size` define was added to rules.vc. Also, whether the version in rules.vc was updated with the change. /Ashok
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [bb69716524] (rid 249389) by oehhar on 2025-12-10 09:07:26:
- icomment:
To conclude: * Tcl_Size is always a define, if TCL_MAX_SIZE is not defined * Tcl_Size define may be present or not So, the boilerplate given by Paul solves all use-cases. I will update the wiki page to include this. Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [97ac6e4a5e] (rid 249390) by oehhar on 2025-12-10 09:11:33:
- closedate changed to: "2461019.88302295"
- closer changed to: "oehhar"
- icomment:
Ok, wiki page updated by commit [f411653044]. The additional proposed <verbatim> #define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj </verbatim> is not handled. THanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "oehhar"