Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Better error-message than "interpreter uses an incompatible stubs mechanism"

Closed / Fixedfc35093cef269e906512ad028d7590f883edb0feCreated 2 years agoUpdated 2 years ago
Descriptionwiki2025-01-03 15:02:11
If a shared library compiled for Tcl 8.x is loaded in Tcl 9.0, the error-message is: "interpreter uses an incompatible stubs mechanism".

We can do better than that, because Tcl 9.0 has a different 'magic' value which is unique compared to other possible error-situations.

Proposal: "this extension is compiled for Tcl 8.x"

jan.nijtmanswiki2025-01-03 16:52:05

Implementation giving the improved error-message: [here]

jan.nijtmanswiki2025-01-07 12:31:48

Fixed [here]

sbronwiki2025-05-06 09:05:33

The current fix will produce the "this extension is compiled for Tcl 8.x" error message for any library with an incompatible stubs mechanism. While that describes the only reason that can happen at present, it fails to take into account that there may be incompatible changes to the stubs mechanism in the future. I can imagine that at some point in the future there may be a Tcl 10 with yet another change to the stubs mechanism. Loading an extension compiled for Tcl 10 into Tcl 9 would then also give the (misleading) indication that the extension was compiled for Tcl 8.x.

I suppose the easiest fix is to change the message to "this extension is compiled for a different Tcl major version", assuming incompatible changes to the stubs mechanism only happen in a major version. Alternative, in case "major version" is considered jargon that may not be clear to the average user, "this extension is not compiled for Tcl 9.x"

jan.nijtmanswiki2025-05-06 09:27:41

Don't worry, all you are mentioning is already taken into account.

See: https://core.tcl-lang.org/tcl/file?name=generic/tclStubLib.c&ci=399d648cc325acd7&ln=80-97

dgpmarkdown2025-05-06 13:31:07

Related background is found here [3588687]

Log in (anonymous is fine) to add a comment.