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-11-27 15:38:51 and 2023-12-11 18:36:59

1
2
3
4
















5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27




+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







(Work in progress...)

Also see [Porting extensions to Tcl 9](https://wiki.tcl-lang.org/page/Porting+extensions+to+Tcl+9)
for another post on the topic.

## Init stubs and package require with open version

The list of versions should include TCL/Tk 9. Here is an example for TCL 8.5 and following versions.
Remark the "-" after "8.5".

~~~
#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, "8.5-", 0) == NULL)
#else
    if (Tcl_PkgRequire(interp, "Tcl", "8.5-", 0) == NULL)
#endif
    {
        return TCL_ERROR;
    }
~~~

## 64-bit data support

On 64-bit platforms, Tcl 9 no longer limits data size (lengths of strings, lists
etc.) and indices to 32-bits. For portability of extensions between 32- and
64-bit platforms, a new typedef `Tcl_Size` has been defined. This maps to a
64-bit or 32-bit signed integer type on the respective platforms. This affects
︙