Tcl 8.0.4 for Windows
|
Tcl 8.0.4 for Windows
|
|
|
by Scott Stanton
|
by Scott Stanton
|
Scriptics Corporation
|
Scriptics Corporation
|
scott.stanton@scriptics.com
|
scott.stanton@scriptics.com
|
|
|
RCS: @(#) $Id: README,v 1.1.1.1 2002-01-16 10:25:38 markom Exp $
|
RCS: @(#) $Id: README,v 1.1.1.1 2002-01-16 10:25:38 markom Exp $
|
|
|
1. Introduction
|
1. Introduction
|
---------------
|
---------------
|
|
|
This is the directory where you configure and compile the Windows
|
This is the directory where you configure and compile the Windows
|
version of Tcl. This directory also contains source files for Tcl
|
version of Tcl. This directory also contains source files for Tcl
|
that are specific to Microsoft Windows. The rest of this file
|
that are specific to Microsoft Windows. The rest of this file
|
contains information specific to the Windows version of Tcl.
|
contains information specific to the Windows version of Tcl.
|
|
|
2. Distribution notes
|
2. Distribution notes
|
---------------------
|
---------------------
|
|
|
Tcl 8.0 for Windows is distributed in binary form in addition to the
|
Tcl 8.0 for Windows is distributed in binary form in addition to the
|
common source release. The binary distribution is a self-extracting
|
common source release. The binary distribution is a self-extracting
|
archive with a built-in installation script.
|
archive with a built-in installation script.
|
|
|
Look for the binary release in the same location as the source release
|
Look for the binary release in the same location as the source release
|
(ftp.scriptics.com:/pub/tcl or any of the mirror sites). For most users,
|
(ftp.scriptics.com:/pub/tcl or any of the mirror sites). For most users,
|
the binary release will be much easier to install and use. You only
|
the binary release will be much easier to install and use. You only
|
need the source release if you plan to modify the core of Tcl, or if
|
need the source release if you plan to modify the core of Tcl, or if
|
you need to compile with a different compiler. With the addition of
|
you need to compile with a different compiler. With the addition of
|
the dynamic loading interface, it is no longer necessary to have the
|
the dynamic loading interface, it is no longer necessary to have the
|
source distribution in order to build and use extensions.
|
source distribution in order to build and use extensions.
|
|
|
3. Compiling Tcl
|
3. Compiling Tcl
|
----------------
|
----------------
|
|
|
In order to compile Tcl for Windows, you need the following items:
|
In order to compile Tcl for Windows, you need the following items:
|
|
|
Tcl 8.0 Source Distribution (plus any patches)
|
Tcl 8.0 Source Distribution (plus any patches)
|
|
|
Borland C++ 4.52 (both 16-bit and 32-bit compilers)
|
Borland C++ 4.52 (both 16-bit and 32-bit compilers)
|
or
|
or
|
Visual C++ 2.x/4.x/5.x
|
Visual C++ 2.x/4.x/5.x
|
Visual C++ 1.5 (to build tcl1680.dll for Win32s support of exec)
|
Visual C++ 1.5 (to build tcl1680.dll for Win32s support of exec)
|
|
|
In practice, the 8.0.4 release is built with Visual C++ 5.0
|
In practice, the 8.0.4 release is built with Visual C++ 5.0
|
|
|
In the "win" subdirectory of the source release, you will find two
|
In the "win" subdirectory of the source release, you will find two
|
files called "makefile.bc" and "makefile.vc". These are the makefiles
|
files called "makefile.bc" and "makefile.vc". These are the makefiles
|
for the Borland and Visual C++ compilers respectively. You should
|
for the Borland and Visual C++ compilers respectively. You should
|
copy the appropriate one to "makefile" and update the paths at the
|
copy the appropriate one to "makefile" and update the paths at the
|
top of the file to reflect your system configuration. Now you can use
|
top of the file to reflect your system configuration. Now you can use
|
"make" (or "nmake" for VC++) to build the tcl libraries and the tclsh
|
"make" (or "nmake" for VC++) to build the tcl libraries and the tclsh
|
executable.
|
executable.
|
|
|
In order to use the binaries generated by these makefiles, you will
|
In order to use the binaries generated by these makefiles, you will
|
need to place the Tcl script library files someplace where Tcl can
|
need to place the Tcl script library files someplace where Tcl can
|
find them. Tcl looks in one of three places for the library files:
|
find them. Tcl looks in one of three places for the library files:
|
|
|
1) The path specified in the environment variable "TCL_LIBRARY".
|
1) The path specified in the environment variable "TCL_LIBRARY".
|
|
|
2) In the lib\tcl8.0 directory under the installation directory
|
2) In the lib\tcl8.0 directory under the installation directory
|
as specified in the registry:
|
as specified in the registry:
|
|
|
For Windows NT & 95:
|
For Windows NT & 95:
|
HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0
|
HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0
|
|
|
For Win32s:
|
For Win32s:
|
HKEY_CLASSES_ROOT\SOFTWARE\Scriptics\Tcl\8.0\
|
HKEY_CLASSES_ROOT\SOFTWARE\Scriptics\Tcl\8.0\
|
|
|
3) Relative to the directory containing the current .exe.
|
3) Relative to the directory containing the current .exe.
|
Tcl will look for a directory "..\lib\tcl8.0" relative to the
|
Tcl will look for a directory "..\lib\tcl8.0" relative to the
|
directory containing the currently running .exe.
|
directory containing the currently running .exe.
|
|
|
Note that in order to run tclsh80.exe, you must ensure that tcl80.dll
|
Note that in order to run tclsh80.exe, you must ensure that tcl80.dll
|
and tclpip80.dll (plus tcl1680.dll under Win32s) are on your path, in
|
and tclpip80.dll (plus tcl1680.dll under Win32s) are on your path, in
|
the system directory, or in the directory containing tclsh80.exe.
|
the system directory, or in the directory containing tclsh80.exe.
|
|
|
4. Building Extensions
|
4. Building Extensions
|
----------------------
|
----------------------
|
|
|
With the Windows compilers you have to worry about how you export symbols
|
With the Windows compilers you have to worry about how you export symbols
|
from DLLs. tcl.h defines a few macros to help solve this problem:
|
from DLLs. tcl.h defines a few macros to help solve this problem:
|
EXTERN - all Tcl_ function prototypes use this macro, which implies
|
EXTERN - all Tcl_ function prototypes use this macro, which implies
|
they are exported. You'll see this used in tcl.h and tk.h.
|
they are exported. You'll see this used in tcl.h and tk.h.
|
You should use this in your exported procedures.
|
You should use this in your exported procedures.
|
However, this is not the whole story.
|
However, this is not the whole story.
|
TCL_STORAGE_CLASS - this is really an import/export flag, depending on if you are
|
TCL_STORAGE_CLASS - this is really an import/export flag, depending on if you are
|
importing symbols from a DLL (i.e., a user of the DLL), or if
|
importing symbols from a DLL (i.e., a user of the DLL), or if
|
you are exporting symbols from the DLL (i.e., you are building it.)
|
you are exporting symbols from the DLL (i.e., you are building it.)
|
The EXTERN macro includes TCL_STORAGE_CLASS.
|
The EXTERN macro includes TCL_STORAGE_CLASS.
|
TCL_STORAGE_CLASS is defined to be either DLLIMPORT or DLLEXPORT as
|
TCL_STORAGE_CLASS is defined to be either DLLIMPORT or DLLEXPORT as
|
described below.
|
described below.
|
STATIC_BUILD - define this if you are *not* building a DLL
|
STATIC_BUILD - define this if you are *not* building a DLL
|
(e.g., a main program)
|
(e.g., a main program)
|
DLL_BUILD - define this if you *are* building a DLL
|
DLL_BUILD - define this if you *are* building a DLL
|
DLLIMPORT - If STATIC_BUILD is defined, this becomes nothing.
|
DLLIMPORT - If STATIC_BUILD is defined, this becomes nothing.
|
(On UNIX, DLLIMPORT is defined to be empty)
|
(On UNIX, DLLIMPORT is defined to be empty)
|
Otherwise, this this expands to __declspec(dllimport)
|
Otherwise, this this expands to __declspec(dllimport)
|
DLLEXPORT - If STATIC_BUILD is defined, this becomes nothing.
|
DLLEXPORT - If STATIC_BUILD is defined, this becomes nothing.
|
(On UNIX, DLLEXPORT is defined to be empty)
|
(On UNIX, DLLEXPORT is defined to be empty)
|
Otherwise, this this expands to __declspec(dllexport)
|
Otherwise, this this expands to __declspec(dllexport)
|
|
|
EXPORT(type, func)
|
EXPORT(type, func)
|
For the Borland compiler, you need to export functions differently.
|
For the Borland compiler, you need to export functions differently.
|
The DLLEXPORT macro is empty, and instead you need to use
|
The DLLEXPORT macro is empty, and instead you need to use
|
EXPORT because they had a different order. Your declaration will
|
EXPORT because they had a different order. Your declaration will
|
look like
|
look like
|
EXTERN EXPORT(int, Foo_Init)(Tcl_Interp *interp);
|
EXTERN EXPORT(int, Foo_Init)(Tcl_Interp *interp);
|
We have not defined EXPORT anywhere. You can paste this into your C file:
|
We have not defined EXPORT anywhere. You can paste this into your C file:
|
#ifndef STATIC_BUILD
|
#ifndef STATIC_BUILD
|
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
# define EXPORT(a,b) __declspec(dllexport) a b
|
# define EXPORT(a,b) __declspec(dllexport) a b
|
# define DllEntryPoint DllMain
|
# define DllEntryPoint DllMain
|
#else
|
#else
|
# if defined(__BORLANDC__)
|
# if defined(__BORLANDC__)
|
# define EXPORT(a,b) a _export b
|
# define EXPORT(a,b) a _export b
|
# else
|
# else
|
# define EXPORT(a,b) a b
|
# define EXPORT(a,b) a b
|
# endif
|
# endif
|
#endif
|
#endif
|
#endif
|
#endif
|
|
|
|
|
How to use these:
|
How to use these:
|
|
|
Assume your extension is named Foo. In its Makefile, define
|
Assume your extension is named Foo. In its Makefile, define
|
BUILD_Foo so that you know you are building Foo and not using it.
|
BUILD_Foo so that you know you are building Foo and not using it.
|
Then, in your main header file, foo.h, conditionally define
|
Then, in your main header file, foo.h, conditionally define
|
EXPORT to be either DLLIMPORT or DLLEXPORT based on the
|
EXPORT to be either DLLIMPORT or DLLEXPORT based on the
|
presense of BUILD_Foo, like this:
|
presense of BUILD_Foo, like this:
|
|
|
#ifndef _FOO
|
#ifndef _FOO
|
#define _FOO
|
#define _FOO
|
#include "tcl.h"
|
#include "tcl.h"
|
/* Additional includes go here */
|
/* Additional includes go here */
|
/*
|
/*
|
* if the BUILD_foo macro is defined, the assumption is that we are
|
* if the BUILD_foo macro is defined, the assumption is that we are
|
* building the dynamic library.
|
* building the dynamic library.
|
*/
|
*/
|
#ifdef BUILD_Foo
|
#ifdef BUILD_Foo
|
# undef TCL_STORAGE_CLASS
|
# undef TCL_STORAGE_CLASS
|
# define TCL_STORAGE_CLASS DLLEXPORT
|
# define TCL_STORAGE_CLASS DLLEXPORT
|
#endif
|
#endif
|
/*
|
/*
|
* Function prototypes for this module.
|
* Function prototypes for this module.
|
*/
|
*/
|
EXTERN int Foo_Init _ANSI_ARGS_((Tcl_Interp *interp));
|
EXTERN int Foo_Init _ANSI_ARGS_((Tcl_Interp *interp));
|
EXTERN int Foo_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
|
EXTERN int Foo_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
|
/* Additional prototypes go here */
|
/* Additional prototypes go here */
|
/*
|
/*
|
* end of foo.h
|
* end of foo.h
|
* reset TCL_STORAGE_CLASS to DLLIMPORT.
|
* reset TCL_STORAGE_CLASS to DLLIMPORT.
|
*/
|
*/
|
# undef TCL_STORAGE_CLASS
|
# undef TCL_STORAGE_CLASS
|
# define TCL_STORAGE_CLASS DLLIMPORT
|
# define TCL_STORAGE_CLASS DLLIMPORT
|
#endif /* _FOO */
|
#endif /* _FOO */
|
|
|
In your C file, put EXTERN before then functions you need to export.
|
In your C file, put EXTERN before then functions you need to export.
|
If you use Borland, you'll need to use the old EXPORT macro, too.
|
If you use Borland, you'll need to use the old EXPORT macro, too.
|
|
|
5. Test suite
|
5. Test suite
|
-------------
|
-------------
|
|
|
This distribution contains an extensive test suite for Tcl. Some of
|
This distribution contains an extensive test suite for Tcl. Some of
|
the tests are timing dependent and will fail from time to time. If a
|
the tests are timing dependent and will fail from time to time. If a
|
test is failing consistently, please send us a bug report with as much
|
test is failing consistently, please send us a bug report with as much
|
detail as you can manage.
|
detail as you can manage.
|
|
|
In order to run the test suite, you build the "test" target using the
|
In order to run the test suite, you build the "test" target using the
|
appropriate makefile for your compiler.
|
appropriate makefile for your compiler.
|
|
|
|
|
6. Known Bugs
|
6. Known Bugs
|
-------------
|
-------------
|
|
|
Here is the current list of known bugs/missing features for the
|
Here is the current list of known bugs/missing features for the
|
Windows version of Tcl:
|
Windows version of Tcl:
|
|
|
- Blocking "after" commands (e.g. "after 3000") don't work on Win32s.
|
- Blocking "after" commands (e.g. "after 3000") don't work on Win32s.
|
- Clock command fails to handle daylight savings time boundaries for
|
- Clock command fails to handle daylight savings time boundaries for
|
things like "last week".
|
things like "last week".
|
- Background processes aren't properly detached on NT.
|
- Background processes aren't properly detached on NT.
|
- File events only work on sockets.
|
- File events only work on sockets.
|
- Pipes/files/console/serial ports don't support nonblocking I/O.
|
- Pipes/files/console/serial ports don't support nonblocking I/O.
|
- The library cannot be used by two processes at the same time under
|
- The library cannot be used by two processes at the same time under
|
Win32s.
|
Win32s.
|
|
|
If you have comments or bug reports for the Windows version of Tcl,
|
If you have comments or bug reports for the Windows version of Tcl,
|
please direct them to:
|
please direct them to:
|
|
|
|
|
|
|
or post them to the comp.lang.tcl newsgroup.
|
or post them to the comp.lang.tcl newsgroup.
|
|
|