6.4.2 Configuring the Tcl/Tk Library Module under Windows

Question:
I need to use a different Tcl/Tk version from the one SICStus is compiled against. How do I do?

The symptom of this is that Windows complains about not finding tcl<ver>.dll.

See the release notes for what version of Tcl/Tk was used to build SICStus. If you want to use another Tcl/Tk version, you need to recompile library(tcltk). You can do this by following these steps:

(Please do not embark on this unless you are fairly familiar with command-prompts and compilation procedures).

  1. You need MSVC version 6.0 or later. 5.x or 4.x might work but have not been tested.
  2. Build a new Tcl/Tk foreign resource (assuming Bash/Cygwin):
              $ cd library/x86-win32-nt-4
              $ mkdir tcltk_new
              $ cd tcltk_new
              $ splfr --cflag=-Ic:/path/to/Tcl/include
              ../../tcltk/*.c ../../tcltk.pl c:/path/to/Tcl/lib/tcl84.lib
              c:/path/to/Tcl/lib/tk84.lib
              $ cp tcltk.dll ../tcltk.dll
         

    If you do not have a shell that expands “*.c”, you need to replace “../../tcltk/*.c” with the name of all C source files in ../../tcltk. Also, don't forget to adjust the actual paths to your Tcl/Tk installation directory.

    The following sample session shows how it may look:

              $ splfr --cflag=-Ih:/MS_Windows_2000/Tcl/include ../../tcltk/*.c ../../tcltk.pl h:/MS_Windows_2000/Tcl/lib/tcl84.lib h:/MS_Windows_2000/Tcl/lib/tk84.lib
              SICStus 3.12.7 ...
              Licensed to SICS
              
              % tcltk_glue_1084_1044046414.c generated, 20 msec
              % tcltk_glue.h generated, 20 msec
              tcl.c
              ../../tcltk/tcl.c(223) : warning C4090: 'function' : different 'const' qualifiers
              ../../tcltk/tcl.c(223) : warning C4024: 'sptcl_save_error' : different types for formal and actual parameter 2
              ../../tcltk/tcl.c(323) : warning C4090: 'function' : different 'const' qualifiers
              ../../tcltk/tcl.c(323) : warning C4024: 'sptcl_save_error' : different types for formal and actual parameter 2
              ../../tcltk/tcl.c(374) : warning C4090: 'function' : different 'const' qualifiers
              ../../tcltk/tcl.c(374) : warning C4024: 'sptcl_save_error' : different types for formal and actual parameter 2
              tk.c
              ../../tcltk/tk.c(134) : warning C4090: 'function' : different 'const' qualifiers
              ../../tcltk/tk.c(134) : warning C4024: 'sptcl_save_error' : different types for formal and actual parameter 2
              ../../tcltk/tk.c(162) : warning C4090: 'function' : different 'const' qualifiers
              ../../tcltk/tk.c(162) : warning C4024: 'sptcl_save_error' : different types for formal and actual parameter 2
              tkappini.c
              tkterm.c
              util.c
              tcltk_glue_1084_1044046414.c
                 Creating library dummy.lib and object dummy.exp
              $ cp tcltk.dll ../tcltk.dll
         
  3. Test your new resource:
              $ sicstus -i
              SICStus 3.12.7 ...
              Licensed to SICS
              | ?- use_module(library(tcltk)).
              % loading c:/program files/sicstus prolog 3.10.0/library/tcltk.po...
              % module tcltk imported into user
              %  loading foreign resource c:/program files/sicstus prolog 3.10.0/library/x86-win32-nt-4/tcltk.dll in module tcltk
              % loaded c:/program files/sicstus prolog 3.10.0/library/tcltk.po in module tcltk, 10 msec 14744 bytes