Check-in [11e42c47e0]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Editorial tweaking of 538
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 11e42c47e07f18038a86da65a1232482f71c37e8ce3df157d5b75aec9c103e2b
User & Date: dkf 2019-04-15 12:22:47
Context
2019-04-16
13:31
TIP 342 is Final check-in: 53c69e3a9d user: dkf tags: trunk
2019-04-15
12:22
Editorial tweaking of 538 check-in: 11e42c47e0 user: dkf tags: trunk
2019-04-14
16:12
Work around a bug in the fossil markdown renderer check-in: 686a2667f2 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tip/538.md.

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# TIP 538: Externalize libtommath
	Author:         Jan Nijtmans <[email protected]>
	State:          Draft
	Type:           Project
	Vote:
	Created:        9-April-2019
	Post-History:
	Keywords:       Tcl
	Tcl-Version:    8.7
	Tcl-Branch:     digit-bit-60
-----

# Abstract

This TIP proposes to add the possibility to link Tcl with an external libtommath library, if available, for shared builds.

# Rationale

Tcl - since 8.6 - has a built-in libtommath library with modifications. By now, many of those modifications
were adopted upstream. This makes it possible to change the built Tcl library, using the external libtommath
library as-is, in stead of using it's own fork. libtommath will continue to be delivered together with
the Tcl source code.

# Specification and Documentation

Starting with libtommath 1.1.0, it is possible to build Tcl without the internal libtommath, but - in stead - linking
with the unmodified, externally built, libtommath. This has the following consequences:

  - On 64-bit platforms (win64, linux-64), libtommath will now be built in 64-bit mode, while Tcl's libtommath used to be
    built in 32-bit mode.  Extensions which depend on the internal structure of the libtommath types will need
    to be re-compiled.

  - On win32/win64, a pre-built libtommath dll will be available, so libtommath will get the same status as
    zlib. Only when Tcl is build statically (--disable-shared) a (subset of) libtommath will still be built-in,
    the same subset that Tcl depends on.

  - One of Tcl's modifications (in mp\_sqrt) [doesn't work in 64-bit mode](https://travis-ci.org/tcltk/tcl/builds/512875496).
    In the implementation branch this modification is reverted. It can be put back as soon as the code is fixed for
    64-bit mode and accepted upstream.

  - Extensions can now choose whether they want to depend on libtommath directly or not. When using "tclTomMath.h",
    they will be linked to Tcl's libtommath stub table, when using "tommath.h" they will be linked directly
    to the external libtommath library. Both ways will continue to be supported. Extensions using "tommath.h"
    can use all available libtommath functions. When using "tclTomMath.h" only a subset is available.

  - "tclTomMath.h" is no longer part of "tclInt.h". So extension depending on "tclInt.h" but using libtommath
    functions will need to be adapted.

  - The types "mp\_digit" and "mp\_word" are no longer declared by tcl.h.  Extensions using those types will need
    to start using the "tclTomMath.h" or "tommath.h" includes as well.

# Implementation

All makefiles are adapted to detect external presence of libtommath 1.1.0 or later. If so, this library will be used
for shared builds, otherwise the built-in libtommath will continue to be used as before.

An implementation of this TIP is present in the [digit-bit-60](https://core.tcl-lang.org/tcl/timeline?r=digit-bit-60) branch.

# Copyright

This document has been placed in the public domain.



|













|

|




|


|



|
|


|



|
|
|
|

|


|
|











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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# TIP 538: Externalize libtommath
	Author:         Jan Nijtmans <[email protected]>
	State:          Draft
	Type:           Project
	Vote:           Pending
	Created:        9-April-2019
	Post-History:
	Keywords:       Tcl
	Tcl-Version:    8.7
	Tcl-Branch:     digit-bit-60
-----

# Abstract

This TIP proposes to add the possibility to link Tcl with an external libtommath library, if available, for shared builds.

# Rationale

Since 8.6, Tcl has had a built-in libtommath library with modifications. By now, many of those modifications
were adopted upstream. This makes it possible to change the built Tcl library, using the external libtommath
library as-is, instead of using it's own fork. libtommath will continue to be delivered together with
the Tcl source code.

# Specification and Documentation

Starting with libtommath 1.1.0, it is possible to build Tcl without the internal libtommath, instead linking
with the unmodified, externally built, libtommath. This has the following consequences:

  * On 64-bit platforms (win64, linux-64), libtommath will now be built in 64-bit mode, while Tcl's libtommath used to be
    built in 32-bit mode.  Extensions which depend on the internal structure of the libtommath types will need
    to be re-compiled.

  * On win32/win64, a pre-built libtommath dll will be available, so libtommath will get the same status as
    zlib. Only when Tcl is build statically (`--disable-shared`) a (subset of) libtommath will still be built-in,
    the same subset that Tcl depends on.

  * One of Tcl's modifications (in mp\_sqrt) [doesn't work in 64-bit mode](https://travis-ci.org/tcltk/tcl/builds/512875496).
    In the implementation branch this modification is reverted. It can be put back as soon as the code is fixed for
    64-bit mode and accepted upstream.

  * Extensions can now choose whether they want to depend on libtommath directly or not. When using "`tclTomMath.h`",
    they will be linked to Tcl's libtommath stub table, when using "`tommath.h`" they will be linked directly
    to the external libtommath library. Both ways will continue to be supported. Extensions using "`tommath.h`"
    can use all available libtommath functions. When using "`tclTomMath.h`" only a subset is available.

  * "`tclTomMath.h`" is no longer part of "`tclInt.h`". So extension depending on "`tclInt.h`" but using libtommath
    functions will need to be adapted.

  * The types "mp\_digit" and "mp\_word" are no longer declared by `tcl.h`.  Extensions using those types will need
    to start using the "`tclTomMath.h`" or "`tommath.h`" includes as well.

# Implementation

All makefiles are adapted to detect external presence of libtommath 1.1.0 or later. If so, this library will be used
for shared builds, otherwise the built-in libtommath will continue to be used as before.

An implementation of this TIP is present in the [digit-bit-60](https://core.tcl-lang.org/tcl/timeline?r=digit-bit-60) branch.

# Copyright

This document has been placed in the public domain.