Skip to content
Tcl Source Code Changes To Migrating C extensions to Tcl 9
Login

Changes To Migrating C extensions to Tcl 9

Changes to "Migrating C extensions to Tcl 9" between 2023-12-20 20:28:14 and 2024-01-14 05:03:00

︙
67
68
69
70
71
72
73
74
75
76
77
78
79
80

81


82
83
84
85
86
87
88
67
68
69
70
71
72
73

74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89







-






+
-
+
+







If the ability to build against Tcl 8 is desired after making the above
changes require for Tcl 9, add the following fragment to the appropriate
header for the extension.

```
#ifndef TCL_SIZE_MAX
# define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
# define Tcl_NewSizeIntObj Tcl_NewIntObj
# define TCL_SIZE_MAX      INT_MAX
# define TCL_SIZE_MODIFIER ""
#endif

```

"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`.
"Tcl_Size" itself doesn't need to be provided: TEA (latest tcl.m4/rules.vc files) takes care of that.

Note there is no complementary `Tcl_NewSizeIntFromObj`. Use `Tcl_NewWideIntObj` in its stead. 

Paul Obermeier's very useful post [Tcl 9 functions using Tcl_Size](https://wiki.tcl-lang.org/page/Tcl+9+functions+using+Tcl%5FSize)
enumerates the functions in the Tcl API affected by this change
and provides a script to locate the use of these functions within
extensions and applications.

See [TIP 660](https://core.tcl-lang.org/tips/doc/trunk/tip/660.md)
︙