OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [win/] [README] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
Tcl 8.0.4 for Windows
2
 
3
by Scott Stanton
4
Scriptics Corporation
5
scott.stanton@scriptics.com
6
 
7
RCS: @(#) $Id: README,v 1.1.1.1 2002-01-16 10:25:38 markom Exp $
8
 
9
1. Introduction
10
---------------
11
 
12
This is the directory where you configure and compile the Windows
13
version of Tcl.  This directory also contains source files for Tcl
14
that are specific to Microsoft Windows.  The rest of this file
15
contains information specific to the Windows version of Tcl.
16
 
17
2. Distribution notes
18
---------------------
19
 
20
Tcl 8.0 for Windows is distributed in binary form in addition to the
21
common source release.  The binary distribution is a self-extracting
22
archive with a built-in installation script.
23
 
24
Look for the binary release in the same location as the source release
25
(ftp.scriptics.com:/pub/tcl or any of the mirror sites).  For most users,
26
the binary release will be much easier to install and use.  You only
27
need the source release if you plan to modify the core of Tcl, or if
28
you need to compile with a different compiler.  With the addition of
29
the dynamic loading interface, it is no longer necessary to have the
30
source distribution in order to build and use extensions.
31
 
32
3. Compiling Tcl
33
----------------
34
 
35
In order to compile Tcl for Windows, you need the following items:
36
 
37
        Tcl 8.0 Source Distribution (plus any patches)
38
 
39
        Borland C++ 4.52 (both 16-bit and 32-bit compilers)
40
          or
41
        Visual C++ 2.x/4.x/5.x
42
        Visual C++ 1.5 (to build tcl1680.dll for Win32s support of exec)
43
 
44
In practice, the 8.0.4 release is built with Visual C++ 5.0
45
 
46
In the "win" subdirectory of the source release, you will find two
47
files called "makefile.bc" and "makefile.vc".  These are the makefiles
48
for the Borland and Visual C++ compilers respectively.  You should
49
copy the appropriate one to "makefile" and update the paths at the
50
top of the file to reflect your system configuration.  Now you can use
51
"make" (or "nmake" for VC++) to build the tcl libraries and the tclsh
52
executable.
53
 
54
In order to use the binaries generated by these makefiles, you will
55
need to place the Tcl script library files someplace where Tcl can
56
find them.  Tcl looks in one of three places for the library files:
57
 
58
        1) The path specified in the environment variable "TCL_LIBRARY".
59
 
60
        2) In the lib\tcl8.0 directory under the installation directory
61
           as specified in the registry:
62
 
63
                For Windows NT & 95:
64
                    HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0
65
 
66
                For Win32s:
67
                    HKEY_CLASSES_ROOT\SOFTWARE\Scriptics\Tcl\8.0\
68
 
69
        3) Relative to the directory containing the current .exe.
70
            Tcl will look for a directory "..\lib\tcl8.0" relative to the
71
            directory containing the currently running .exe.
72
 
73
Note that in order to run tclsh80.exe, you must ensure that tcl80.dll
74
and tclpip80.dll (plus tcl1680.dll under Win32s) are on your path, in
75
the system directory, or in the directory containing tclsh80.exe.
76
 
77
4. Building Extensions
78
----------------------
79
 
80
With the Windows compilers you have to worry about how you export symbols
81
from DLLs.  tcl.h defines a few macros to help solve this problem:
82
EXTERN - all Tcl_ function prototypes use this macro, which implies
83
        they are exported.  You'll see this used in tcl.h and tk.h.
84
        You should use this in your exported procedures.
85
        However, this is not the whole story.
86
TCL_STORAGE_CLASS - this is really an import/export flag, depending on if you are
87
        importing symbols from a DLL (i.e., a user of the DLL), or if
88
        you are exporting symbols from the DLL (i.e., you are building it.)
89
        The EXTERN macro includes TCL_STORAGE_CLASS.
90
        TCL_STORAGE_CLASS is defined to be either DLLIMPORT or DLLEXPORT as
91
        described below.
92
STATIC_BUILD - define this if you are *not* building a DLL
93
        (e.g., a main program)
94
DLL_BUILD - define this if you *are* building a DLL
95
DLLIMPORT - If STATIC_BUILD is defined, this becomes nothing.
96
        (On UNIX, DLLIMPORT is defined to be empty)
97
        Otherwise, this this expands to __declspec(dllimport)
98
DLLEXPORT - If STATIC_BUILD is defined, this becomes nothing.
99
        (On UNIX, DLLEXPORT is defined to be empty)
100
        Otherwise, this this expands to __declspec(dllexport)
101
 
102
EXPORT(type, func)
103
        For the Borland compiler, you need to export functions differently.
104
        The DLLEXPORT macro is empty, and instead you need to use
105
        EXPORT because they had a different order.  Your declaration will
106
        look like
107
        EXTERN EXPORT(int, Foo_Init)(Tcl_Interp *interp);
108
We have not defined EXPORT anywhere.  You can paste this into your C file:
109
#ifndef STATIC_BUILD
110
#if defined(_MSC_VER)
111
#   define EXPORT(a,b) __declspec(dllexport) a b
112
#   define DllEntryPoint DllMain
113
#else
114
#   if defined(__BORLANDC__)
115
#       define EXPORT(a,b) a _export b
116
#   else
117
#       define EXPORT(a,b) a b
118
#   endif
119
#endif
120
#endif
121
 
122
 
123
How to use these:
124
 
125
Assume your extension is named Foo.  In its Makefile, define
126
BUILD_Foo so that you know you are building Foo and not using it.
127
Then, in your main header file, foo.h, conditionally define
128
EXPORT to be either DLLIMPORT or DLLEXPORT based on the
129
presense of BUILD_Foo, like this:
130
 
131
#ifndef _FOO
132
#define _FOO
133
#include "tcl.h"
134
/* Additional includes go here */
135
/*
136
 * if the BUILD_foo macro is defined, the assumption is that we are
137
 * building the dynamic library.
138
 */
139
#ifdef BUILD_Foo
140
#  undef TCL_STORAGE_CLASS
141
#  define TCL_STORAGE_CLASS DLLEXPORT
142
#endif
143
/*
144
 * Function prototypes for this module.
145
 */
146
EXTERN int Foo_Init _ANSI_ARGS_((Tcl_Interp *interp));
147
EXTERN int Foo_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
148
/* Additional prototypes go here */
149
/*
150
 * end of foo.h
151
 * reset TCL_STORAGE_CLASS to DLLIMPORT.
152
 */
153
# undef TCL_STORAGE_CLASS
154
# define TCL_STORAGE_CLASS DLLIMPORT
155
#endif /* _FOO */
156
 
157
In your C file, put EXTERN before then functions you need to export.
158
If you use Borland, you'll need to use the old EXPORT macro, too.
159
 
160
5. Test suite
161
-------------
162
 
163
This distribution contains an extensive test suite for Tcl.  Some of
164
the tests are timing dependent and will fail from time to time.  If a
165
test is failing consistently, please send us a bug report with as much
166
detail as you can manage.
167
 
168
In order to run the test suite, you build the "test" target using the
169
appropriate makefile for your compiler.
170
 
171
 
172
6. Known Bugs
173
-------------
174
 
175
Here is the current list of known bugs/missing features for the
176
Windows version of Tcl:
177
 
178
- Blocking "after" commands (e.g. "after 3000") don't work on Win32s.
179
- Clock command fails to handle daylight savings time boundaries for
180
  things like "last week".
181
- Background processes aren't properly detached on NT.
182
- File events only work on sockets.
183
- Pipes/files/console/serial ports don't support nonblocking I/O.
184
- The library cannot be used by two processes at the same time under
185
  Win32s.
186
 
187
If you have comments or bug reports for the Windows version of Tcl,
188
please direct them to:
189
 
190
191
 
192
or post them to the comp.lang.tcl newsgroup.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.