Re: version conflict for package "Tcl": TCL_VERSION vs TCL_PATCH_LEVEL



Olaf Dietrich wrote:
I find the following inconsistent(?) behavior of a self-written
Tcl package with the line

Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 1)
....
* compiled under Tcl 8.5, I can't load the package; the error
message is:

'version conflict for package "Tcl": have 8.5.1, need exactly 8.5'

[package provide Tcl] now records full patchlevel information, so
asking for an "exact" match is a considerably more strict (and
considerably less useful) demand than it used to be. You should
at least consider relaxing your demands by changing the 1 to a 0.

> ... How could
I make my Tcl extension be loadable under all patchlevels
of a given Tcl version (but *not* under a different minor
or major version)?

Replace the Tcl_PkgRequire() call above with:

Tcl_InitStubs(interp, TCL_VERSION, 1);

And yes, I know about Tcl_InitStubs() etc. but I would like to
provide an alternative indedpendent of the stubs mechanism.

Not to worry. The Tcl_InitStubs() calls doesn't actually do anything
with stubs unless you compile with the -DUSE_TCL_STUBS directive.

Without -DUSE_TCL_STUBS, the Tcl_InitStubs() call is a macro that expands
into the right routine (Tcl_PkgRequire() in 8.4, Tcl_PkgInitStubsCheck()
in 8.5) to bridge the source incompatibility you've encountered.

With that revision, your source code will once again be able to compile
into working code against both 8.4 and 8.5 headers. (and earlier and later).

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.



Relevant Pages

  • Re: building a starkit of Img?
    ... Because if I use my system Tcl, some things are going to be different, ... compile stuff, so that that ... Not yet:-) I'm actually trying to just do an Img starkit, ... > truly simple, quick, and robust installs are acceptable. ...
    (comp.lang.tcl)
  • Re: CEPTCL: Doesnt RX multicast, has anyone seen it work before?
    ... on my Linux. ... gave me are set up to compile for windows. ... has all of the files and the makefile is set up for Linux too. ... please modify the Makefile for proper Tcl path. ...
    (comp.lang.tcl)
  • Re: convert tcl in a standalone application thanks to MinGw
    ... already many proposed solution, I didn't find the right solution. ... I found it cool to combine C and tcl. ... you only have to compile your c extension and any C compiler may ... set rootdir $starkit::topdir ...
    (comp.lang.tcl)
  • Re: tcl upgrade on redhat 5.2
    ... I ran "make" and the tcl compile went ... switch as I did with the tcl. ... Must I be in XWindows to compile TK? ...
    (comp.lang.tcl)
  • cannot link dll : undefined reference to `tclStubsPtr
    ... I am trying to build a dll for windows from a linux platform using ... The dll is a package extension for tcl. ... I first compile supporting ".o"s without any special flags (they don't ... `tclStubsPtr' ...
    (comp.lang.tcl)