This page lists the Frequently Asked Questions for TclPro.
If you have a question that is not addressed on this
page, please check the known bugs list.
These pages are pertinent to the old Scriptics' TclPro and only apply
in part to ActiveState TclPro .
1. TclPro
- 1.1.
What platforms does TclPro support?
-
TclPro 1.4.1 is currently available on the following platforms:
- Windows 95, 98, NT 4.0 (Intel), 2000
- Solaris 2.5, 2.6, 7 (SPARC)
- HP-UX 10.20
- Linux (Intel, Red Hat 5.0+, SuSE 6.0+)
- SGI IRIX 6.3+
Note: The Linux distribution is for the Intel platform and the glibc2 C library.
ActiveState TclPro supports:
- Windows 98, ME, NT4, 2000, XP
- Solaris 2.6+
- Linux (kernel 2.2+ x86 and 2.4+ IA-64)
- HP-UX 11 (PA-RISC and IA-64)
- 1.2.
When installing TclPro on a Windows 95 PC, I receive a message that
CTL3D32.DLL is the wrong version and that the product only works
on Windows NT.
-
This message indicates that the version of CTL3D32.DLL you have is
old. You can upgrade the DLL by installing OSR 2/3 or Internet
Explorer 4.0. Please note that this message does not affect the
installation or functionality of TclPro. You can click OK and complete
the installation.
- 1.3.
How do I use the bundled extensions with protclsh or prowish?
-
The bundled extenstions are provided as packages. This allows you to
load only the packages you want to work with. Your protclsh80 or
prowish80 application must execute the "package require" command to
load each package individually.
package require Itcl
package require Itk
package require Iwidgets
package require Expect
package require Tclx
- 1.4.
My configure scripts look for tclConfig.sh, tkConfig.sh, itclConfig.sh,
itkConfig.sh and tclXConfig.sh. Where can I find them in the TclPro
distribution directory?
-
These files are not distributed with TclPro. However, if you install
the source code for Tcl/Tk and bundled extensions from the TclPro
CD ROM, you can generate
these files by running configure in the appropriate directories. The
source code is installed into the TclPro<version>/src directory.
- 1.5.
How do I use the debug builds on windows with TclPro1.4? VC++ can't
load symbols from them.
-
Due to a small error we made building the software, symbols were stored
not in the executable, but in a "program database" file what wasn't
included. Basically, our debug builds are worthless as they are pointing
to the missing files and will require the user to rebuild of the core and
components from scratch to step-debug through the sources.
- 1.6.
When I link with the tcl83.lib import library using VC++ 5.0, I get an error.
-
Your linker needs upgrading with a service pack to understand the VC++
v 6.0
compressed format that was used to create this product. See
Visual Studio 97 Service Packs.
2. Upgrading TclPro
- 2.1.
How can I upgrade TclPro on Windows?
-
When upgrading from a prior version of TclPro, you should install the
new version and run the new TclPro Debugger before uninstalling the
prior version. Doing so ensures that your license and TclPro
Debugger preferences are carried over from the prior TclPro version.
We recommend that you use the Wise uninstaller to uninstall a prior
TclPro version. You can do so by selecting the following in your
Start menu:
Settings | Control Panel | Add/Remove Programs
Select the TclPro version you are uninstalling, and press
"Add/Remove".
You then need to remove references to previous installations of TclPro
from your PATH environment variable, so the current executables are
not be overshadowed by previously installed ones. To edit your PATH
on Windows NT, select the following in your Start menu:
Settings | Control Panel | System | Environment Scroll
to the Path variable and double click on it. For Windows 95, edit the
PATH in the C:\autoexec.bat file.
If you are using Windows 95, you should reboot your machine once you
have finished the upgrade.
- 2.2.
How can I upgrade TclPro on Unix?
-
When upgrading from a prior version of TclPro, we recommend that you
install the new version before uninstalling the prior version. Once
you have successfully installed the new version of TclPro, you can
uninstall a prior version by recursively removing the target directory
of the installation as follows:
/usr/bin/rm -rf /opt/scriptics/TclPro1.0
Remember to update your PATH environment variable to point to the new
TclPro version.
3. TclPro License Key
- 3.1.
When entering an evaluation license key for TclPro, I get the
"invalid key" error message. Do I need to get a new key?
-
The "invalid key" error is raised as a result of three conditions:
1. Entering a Shared Network License into the License field at the
end of the installation. By default, a Named User License is
issued unless the user explicitly selects Shared Network License
during the evaluation download process
2. Entering an expired key
3. Using a license for TclPro 1.0 or 1.1 with TclPro 1.2
Shared Network Licenses work in conjunction with Scriptics
License Servers. If you made a mistake and receive a Shared
Network License, you can request a new Named User License by
reregistering for the evaluation and selecting the desired key when
prompted. You do not need to download the software again.
4. Scriptics License Server
- 4.1.
How can I change the Scriptics License Server host and port
for a site installation?
-
You can run the License Manager program (prolicense) with
the -admin option. This updates the information in the
site installation of TclPro.
- 4.2.
Received the following error when trying to connect to the License
Server via the web browser:
error while autoloading "Auth_Check": couldn't read file
"tclhttpd/lib/auth.tbc": no such file or directory
-
This is caused by the fact that the user id specified during the
installation process does not have a permission to access the
directory where the License Server is installed. Please check
to make sure that the user id specified during the installation
has the permission on the License Server installation directory
and try to connect to the License Server again.
5. TclPro Debugger
- 5.1.
Can I use TclPro Debugger to debug a Tcl 7.3 application?
-
No. TclPro Debugger works with standard distributions of Tcl
and Tk that support the "socket" command, which is available
in Tcl Version 7.6 or later. TclPro Debugger uses the "socket"
command for communication with the application you are debugging.
- 5.2.
TclPro Debugger doesn't appear to understand Tk commands.
-
RFE ID 523
If you are experiencing this behavior, check the "Interpreter" entry
in your project. You can check this by selecting the "File | Edit
Project" menu entry. Be sure you are using a Tk interpreter, such as
prowish80.
Beginning in TclPro 1.1, the default interpreter for a project is
prowish80.
- 5.3.
Can I use TclPro Debugger to debug Tcl applications that use Tcl
extensions?
-
TclPro Debugger supports debugging Tcl scripts that use the
bundled extensions and any
extensions that do not rename or redefine any of the following core
Tcl commands:
append array break catch cd close concat continue
eof error eval exit expr fconfigure file fileevent
flush for foreach gets global if incr info lappend
lindex linsert list llength lrange lreplace lsearch
namespace open puts proc pwd read regexp regsub rename
return set string switch trace unset uplevel upvar
variable vwait while
See the next question for details on extensions that rename the
"source" command.
If none of these commands are renamed or redefined, TclPro Debugger
can debug your application. However, please note that if your
extension defines new control structures (e.g., procedures that take
scripts (to be evaluated) as arguments), the only way to stop the
application when the scripts are being evaluated is with
variable-breakpoints.
- 5.4.
Can my application redefine the "source" command?
-
If your application renames the "source" command, and then redefines
it to call the original version of "source", you can run your
application as an "embedded" application, where the code that renames
and redefines "source" is sourced before the Debugger is contacted.
Your "embedded" application may resemble the following:
# redefine the source command
rename source source_original
proc source args {
puts "called source"
set cmd "source_original $args"
eval $cmd
}
# contact the debugger
source ${TclProDir}/prodebug.tcl
if {[debugger_init remoteMachine 5000] == 1} {
return "cannot communicate with \\
remoteMachine on port 5000"
}
debugger_eval {
# ... your code goes here ...
}
See the "embedded applications" section of the TclPro User's Guide
(located in the "doc" directory of your TclPro release) for more
details.
- 5.5.
How can I change the default project settings?
-
The default project settings option is activated only if no project is
open. If you want to change the default project settings, first close
the current project, then select File and Default Project Settings from
the menu bar. The changes to the default project settings will apply to
future projects you create.
- 5.6.
How do I delete projects?
-
RFE ID 118
In TclPro 1.0 and 1.1, TclPro Debugger stores up to 8 projects in "most
recently used" order. When you create your 9th project, the least
recently used one is dropped from the list. Otherwise, there is no
way to delete a project.
Starting in TclPro 1.2, project information is now kept in a file with
the .tpj extension. There is one .tpj file for each project. If you want
to delete a project, you can delete the file on disk. If you try to
bring up the deleted project, TclPro Debugger issues a message
indicating that the project file is not found.
- 5.7.
How can I get TclPro Debugger to instrument my script and stop at the first
line of the script in the code window?
-
This is the default behavior if you are running TclPro 1.0 or TclPro 1.1. In
TclPro 1.2, you can click the 'Step In' button to achieve the same result.
- 5.8.
TclPro Debugger lets me put a breakpoint on comment lines,
empty lines and curly-brace lines but ignores them.
-
TclPro Debugger adds a hyphen in the grey bar in the code window to
indicate which lines you can set breakpoints on. When you first load
your script into TclPro Debugger, the code is not instrumented and you
see the hyphen on every line of code. Although you can
set a breakpoint on comment lines, empty lines, or curly-brace lines
at this point, TclPro Debugger ignores these breakpoints once the
code is instrumented. This is also true whenever you restart your
debugging session.
TclPro records breakpoints by line number, and each command is associated
with the line that it begins on. A breakpoint triggers only when a
command is about to execute that has the same line number as the given
breakpoint. If you set a breakpoint on a line of code, and then later
edit the file so that line number becomes a blank or comment line,
TclPro Debugger retains the breakpoint in its memory and displays it
in the breakpoint window, but the breakpoint does not appear in the code
display, nor is it triggered.
- 5.9.
How can I force a breakpoint to occur as a result of pressing a button
on my Tk GUI?
-
There are two ways to do this. Both ways require that your button's
callback script consist of a single procedure call. The callback
script is the argument following the -command flag in the
button command. This requirement exists because you cannot set
line-breakpoints in callback scripts, nor can you single-step through
these scripts. The following is an example of how to fix your
callback script:
button .main.quit -text "Q" -command {
# ... lots of detailed code here ...
destroy .
exit
}
should be changed to
proc quit {} {
# ... lots of detailed code here ...
destroy .
exit
}
button .main.quit -text "Q" -command quit
Once you have made this change, you can add a breakpoint on the first
line of code in the body of the procedure called in the button's
callback script.
Or, if your application is completely idle when you want to press the
button in question, then you can force an interrupt to occur in the
callback procedure. To do this, interrupt your idle application by
pressing the "stop" button on the debugger's tool bar. Once the
application stops, press the "step in" button on the debugger's tool
bar. Then press the desired button on your application's GUI.
TclPro Debugger stops just before evaluating the first line of code in
the body of the callback procedure.
- 5.10.
A breakpoint that is set on a procedure definition only stops when the
procedure is defined. How do I set a breakpoint on a procedure
invocation?
-
There are some cases when a programmer does want to stop the
application just before a procedure is defined. If you want to stop
the debugger each time the proc is invoked, you need to set the
breakpoint on the first line of code in the procedure's body. Once a
procedure has been defined in the application, you can use the
Procedure window (via the View menu) to find the procedure's body.
- 5.11.
Does TclPro Debugger support debugging of multiple interps?
-
RFE ID 468
TclPro Debugger does not support debugging multiple interpreters.
However, multiple interpreters could be debugged using multiple
instances of the debugger. If each interpreter is treated as a
separate remote application that uses a different port to connect to
its own debugger instance, then multiple interpreter debugging could
be accomplished.
- 5.12.
Does TclPro Debugger support debugging a
multi-threaded application?
-
RFE ID 1196
TclPro Debugger currently does not support debugging a
multi-threaded application.
- 5.13.
My Tk application's window doesn't appear until all the code is
executed. How can I watch incremental progress?
-
Tk redraws widgets after processing each event. Evaluation of the
script that you entered in the project entry is one event, so
redrawing doesn't occur until all the code is executed. However, the
Tk command "update" causes the Tk interpreter to redraw all windows.
To use this command without editing your Tk script, try the following:
- run your application in TclPro Debugger
- add a breakpoint on the line of code following the first call to pack, grid, or place.
- continue running the application
- once the application stops, open the "eval console" (E button on the toolbar)
- type "update" in the "eval console" and press return
- step through your application, calling "update" after each call to pack, grid, or place.
- 5.14.
I can see only built-in commands in the procedure window. How can I
view the procedures that my application defines?
-
If you view the procedure window just after launching the application
(before running it), the procedures are not yet defined in the
application, so the debugger cannot list them in the procedure window.
In the following script, the procedure myProc cannot appear in the
procedure window until it stops at the breakpoint on line 7.
1 set x 0
2
3 proc myProc {} {
4 puts "hello, world"
5 }
6
*7 set y 1
8 myProc
- 5.15.
Why is the Procedure Window empty?
-
Procedure names can appear only in the Procedure Window when the
application is stopped. Otherwise, the Debugger cannot guarantee that
the procedure list is up-to-date.
- 5.16.
Why does the code display say "No source code available"?
-
RFE ID 90
When users hit the "stop" button while the program is waiting for
events in the event loop, no code is displayed. This is normal,
since no code was actually being executed in the current stack frame.
See the stack display to find out how the event loop was entered.
- 5.17.
How can I get balloon help for the buttons in the tool bar?
-
If you leave your mouse over a button for one second, a description of
the button's functionality appears in the status bar in the lower left
corner of the main Debugger window. We do realize this solution is
not as nice as balloon help, and we are considering adding balloon help
in some later release of TclPro.
- 5.18.
How do I debug an embedded or remotely running application?
-
TclPro Debugger includes an API for embedded and remote applications.
For instructions on how to use this API, see the section labeled
"Debugging Remote, Embedded, and CGI Applications" in the TclPro User's
Guide located in the doc directory of your TclPro distribution.
Starting in TclPro 1.2, you need to create a project for your remote
debugging session. To create a project, select File and New Project
from the menu bar. Select Remote Debugging and specify a port number
if you do not want to use the default (port 2576).
If you have done remote debugging using TclPro 1.0 or 1.1, you still
need to create a project as TclPro Debugger no longer uses the default
settings for remote debugging. You should also check to make sure that
the port number you specified after debugger_init is the same as the
one you specified when creating the project. You can check if your
application is connecting to TclPro Debugger by selecting the connection
status window under the view option on the menu bar.
- 5.19.
I have set up my scripts for remote debugging. Does this affect
the execution of my script if TclPro Debugger is not present?
-
The way remote debugging works is first, debugger_init makes a
connection to TclPro Debugger. Once the connection is established,
debugger_eval sends the code and TclPro Debugger instruments
the code it receives.
If TclPro Debugger is absent, the application is not instrumented
and executes normally.
- 5.20.
Windows only: How can I keep the stdout console from disappearing
after the script exits?
-
Use a line-based breakpoint to stop the application just before it
exits. You may need to add an extra line of "dummy" code to your
script.
- 5.21.
How can I change the value of a variable while the application is
running?
-
When the application is stopped, you can use the "Eval Console" (via
the "E" button on the tool bar) to set variables. In fact, you can
even set new variables and redefine procedures in the eval console.
- 5.22.
Why is the Eval Console grayed out?
-
You can enter commands to be evaluated only when the application is
stopped.
- 5.23.
Why can't I abbreviate commands or use the "ls" and "history" commands
in the Eval Console?
-
The target application is not running in interactive mode. Because
the Eval Console is an interface into the target application, it
cannot run in interactive mode either. Abbreviation of commands, as
well as use of the "ls" and "history" commands is available only in
interactive Tcl/Tk sessions.
- 5.24.
Will running my application in the debugger alter its behavior
as compared to running my application independently?
-
TclPro Debugger rarely affects the target application's behavior.
There are several obscure cases in which the target application's
communication with the debugger alters the target application's
environment. For example, the value of the "info cmdcount" command is
inflated by "Nub" calls that are necessary for communication with the
debugger. Another example of altered application state occurs on Unix
platforms: the difference with the debugger is that a file descriptor
must always exist--that is the debugger connection to the application.
On Unix, calls to "vwait" that are made when no file descriptor exists
would normally return an error stating that the call "would wait
forever". Since the debugger imposes a file descriptor, the bad
"vwait" call will indeed wait forever. However, the user can
introduce new events via the "Eval Console" to keep the application
from hanging indefinitely. If you are experiencing what you consider
to be "altered behavior", please check the known bug list and report the problem if
it is not already listed there.
- 5.25.
If I run a script in TclPro Debugger, where do the stdout and stderr go?
-
On Unix, stdout and stderr go to the shell where you invoke TclPro
Debugger.
- 5.26.
I am debugging an application that includes bytecode files but I don't
want TclPro Debugger to instrument these files. What can I do?
-
You can specify the name of the bytecode files under the "Do Not Instrument"
section under the Instrument tab in the project settings for the desired
project.
- 5.27.
Can I use my custom interpreter with TclPro Debugger?
-
TclPro Debugger will work with any custom interpreters that process
arguments in the same fashion as a regular Tcl interpreter and do not
rename or redefine any of the following core Tcl commands:
append array break catch cd close concat continue
eof error eval exit expr fconfigure file fileevent
flush for foreach gets global if incr info lappend
lindex linsert list llength lrange lreplace lsearch
namespace open puts proc pwd read regexp regsub rename
return set string switch trace unset uplevel upvar
variable vwait while
All you have to do is to specify your custom interpreter instead of
selecting those provided with TclPro.
If your interpreter doesn't accept as its first command-line argument a
Tcl script to execute or if it doesn't pass subsequent command-line
arguments to the script using the standard argc and argv Tcl variables,
then you must take special steps to use your interpreter with TclPro
Debugger. Please refer to the "Using Custom Tcl Interpreters with TclPro
Debugger" section in Chapter 3 of the TclPro User's Guide.
- 5.28.
My application runs very slowly inside TclPro Debugger. What can I do
to improve the speed?
-
Instrumentation may affect the performance when running
a large application in TclPro Debugger. There are two ways you can improve
the speed:
1. Specify which files you do not want to instrument. You can do this
by opening the project, select Project Settings from the File menu
option. Under the Instrumentation tab, specify the files you do not
want to instrument.
2. Uninstrument selected procedures by bringing up the Proc window,
highlight the procedures you do not want to instrument and click
Uninstrument.
6. TclPro Checker
- 6.1.
Can I use TclPro Checker to check Tcl 7.3 scripts?
-
Yes. TclPro Checker works with Tcl/Tk versions 7.3/3.6 or later. Use
the "-use" flag to specify which version of Tcl you wish to check your
code against. You can use "-use tk8.0" to help upgrade your scripts
to work in Tcl/Tk 8.0.
- 6.2.
Can I use TclPro Checker to check Tcl code that uses Tcl extensions?
-
TclPro Checker checks the syntax of your Tcl code, regardless of which
extensions your code uses. However, TclPro Checker checks only the
number and types of arguments for commands defined in extensions that
TclPro officially supports with the exception of [incr Widgets].
- 6.3.
Does TclPro Checker check for wrong number of arguments for
user-defined procs?
-
RFE ID 202
The current version of TclPro Checker does not have this feature.
However, we expect to include this feature in a future TclPro version.
- 6.4.
Does TclPro Checker check for use of undefined variables?
-
RFE ID 203
The current version of TclPro Checker does not have this feature.
However, we expect to include this feature in a future TclPro version.
- 6.5.
Does TclPro Checker check for variables that are written to but never
read or procedures that are defined but never called?
-
RFE ID 247
The current version of TclPro Checker does not have this feature.
However, we expect to include this feature in a future TclPro version.
- 6.6.
Does TclPro Checker give warnings for Y2K violations?
-
RFE ID 329
The current version of TclPro Checker does not have this feature.
However, we expect to include this feature in a future TclPro version.
- 6.7.
What does it mean when I get the message, "(warnExpr) use curly braces
to avoid double substitution"?
-
Tcl expressions perform a second level of command and variable
substitution. In control structures like "while", it is important
that variables and commands are substituted during this second round
of substitution. For example, in the script:
while $x < 1 { incr x }
the while command will either loop forever or never run depending on
the initial value of the variable x. In this case, the correct code
would look like:
while {$x < 1} { incr x }
Turning the expression argument to 'while' into a literal value
ensures that the value of x is re-substituted on each iteration of
the loop when the expression does the second round of substitution.
TclPro Checker generates warnings when a command expects an expression
as an argument, and the expression requires substitutions. For example,
expr $n * 42
requires that $n be substituted. This could be rewritten as:
expr {$n * 42}
where no substitution is required. Most of the time, both of these
commands will give exactly the same result. However there are a
couple of important differences between them.
First, in Tcl 8.0 the second example will produce more efficient code
because only one round of substitutions is needed and the expression
can be compiled inline.
Additionally, if the value of 'n' is coming from an untrusted source
(e.g. a socket), it is very important that the second form be used so
that you do not introduce a security hole. If 'n' had the value [exit],
then in the first example, the first round of substitution would cause
the expression '[exit] * 42' to be executed and the 'exit' command
would be invoked during the second round of substitution. In the
second example, the same input would cause the expression '$n * 42'
to be evaluated and the value [exit] would generate an invalid number
error without executing the 'exit' command.
7. TclPro Compiler
- 7.1.
In which Tcl interpreters can I run my compiled (*.tbc) Tcl files?
-
Compiled (*.tbc) Tcl files can be sourced only by Tcl/Tk8.0.3
interpreters (prowish80 and protclsh80).
- 7.2.
Can Tcl files compiled by TclPro Compiler be sourced cross-platform?
-
Yes. Files compiled by TclPro Compiler are valid Tcl code that can be
sourced in Tcl/Tk 8.0.3 interpreters on any platform where TclPro is
supported. The constraint that TclPro must be supported on the given
platform exists because the tbcload package (required for sourcing
compiled Tcl code) is available only on platforms where TclPro is
available. See the TclPro license information for more details on how
to distribute compiled Tcl code to your end-users.
- 7.3.
How can I source both the .tcl and .tbc file in my wrapped application?
-
You can wrap the source command as follows:
namespace eval startup {
# Check if the bytecode reader can be loaded successfully.
if {[catch {package require tbcload}] == 1} {
variable ::hasLoader 0
} else {
variable ::hasLoader 1
}
}
proc ::MySource { path } {
variable ::hasLoader
set stem [file rootname $path]
set loadTcl 1
# If the bytecode reader is loaded and the .tbc file exists,
# load the .tbc file. Otherwise, load the .tcl file.
if {($hasLoader == 1) && ([file exists $stem.tbc] == 1)} {
set loadTcl [catch {uplevel 1 [list source $stem.tbc]}]
}
if {$loadTcl == 1} {
uplevel 1 [list source $stem.tcl]
}
}
Your script would use MySource instead of the original source command.
- 7.4.
Can I create a tclIndex file from the .tbc files?
-
Yes. In Tcl 8.0.5, the auto_mkIndex command has been enhanced to process
the .tbc file. Please note that this does not work if the original script
contains code that executes outside of procedure definitions.
- 7.5.
Can I create a pkgIndex file from the .tbc files?
-
Yes. In Tcl 8.0.4, to process a library that contains .tbc files, you
must use the following command:
pkg_mkIndex -load tbcload $dir *.tbc
so that the tbcload package is loaded into the slave interpreter
used to process the index. Please note that the pkg_mkIndex mechanism
has been improved significantly in Tcl 8.0.4. We recommend that you
upgrade to this version of Tcl if your work involves setting up packages.
- 7.6.
When I run my compiled Tcl script, I get the error "The TclPro
ByteCode Loader is not available"
-
This error occurs when you try to source a compiled Tcl file in any
interpreter other than Tcl/Tk8.0.3 (prowish80 and protclsh80).
- 7.7.
When I compile a Tcl script, are any of the comments still visible in
the compiled file?
-
By default, TclPro Compiler copies the leading comments from the input
file to the compiled file. Leading comments means everything from the
start of the file to the first non-comment or empty line. The
remaining comments in the input file do not appear in the compiled
file. To avoid copying any comments, add the "-prefix none" argument to
the procomp command line. To copy more comments than the default
allows, add the "-prefix tag" argument to the procomp command line.
- 7.8.
When I compile a Tcl script, what code is hidden?
-
The answer to this question depends on what you mean by "hidden".
TclPro Compiler stores all Tcl strings with a modified ASCII-85
compression algorithm. This means that the components of your Tcl
script are not readily available to a casual observer; for example, if
someone were to open your .tbc files in a text editor, all they would
see is a long sequence of characters. However, ASCII-85 is not an
encryption algorithm, and it is expected that even relatively
unsophisticated users can extract the clear-text.
There is a second level of hiding that applies to components of the
script that were compiled. In this case, the source is not present in
the .tbc file; rather, the byte-codes are. Because Tcl provides a high
degree of support for introspection, it is possible in many cases to
reconstruct the sources from the byte-codes. How easy this is depends
on the original nature of the sources that were compiled. In general,
if the sources contain many calls to commands that are compiled by
Tcl, it is harder to reconstruct the original.
Currently, TclPro Compiler compiles the top-level script, plus
procedure bodies for procedures that are defined at the top level and
where the arguments to the proc command are not subcommands or
variable references. For example, the procedure body of "foo" will be
hidden by TclPro Compiler, but the procedure body of "bar" will not
be hidden:
proc foo {x y} {
return [list $x $y]
}
set body {return [list $x $y]}
proc bar {x y} $body
- 7.9.
When I run my compiled Tcl script, I get the error "called a copy of a
compiled script". What is causing this error?
-
For procedures defined in compiled code, the "info body" command
returns the following:
body = # Compiled -- no source code available
The "called a copy of a compiled script" error occurs when your
compiled Tcl code tries to evaluate the result of "info body". For
example:
proc A {} {
set x 5
return "hello world $x"
}
proc B {} [info body A]
B
A work-around is to use the alias mechanism:
proc A {} {
set x 5
return "hello world $x"
}
interp alias {} B {} A
B
8. Tcl Wrapper
- 8.1.
How do I use the bundled extensions in my wrapped application?
-
The bundled extenstions are provided as packages. This allows you
to load only the packages you want to work with. Your wrapped
application must execute the package require command to load each
package individually, just as an unwrapped protclsh80 or prowish80
application would.
package require Itcl
package require Itk
package require Iwidgets
package require Expect
package require Tclx
- 8.2.
Can I use TclPro Wrapper with unsupported extensions?
-
Yes. You first have to decide if you want to build a statically linked
or a dynamically linked wrapped application. For a statically linked
wrapped application, you need to build a custom interpreter that includes
your extensions and the support for TclPro Wrapper. Please refer to the
"How to Wrap" section at:
http://www.scriptics.com/support/howto/wrap.html
for more information on how to build the interpreter.
If you plan to create a dynamically linked wrapped application, you can
distribute your extensions along with the wrapped application. Please
refer to the TclPro Wrapper chapter in our User's Guide for more information
on how to distribute a dynamically wrapped application.
- 8.3.
Can I create a stand-alone executable for a Tk 4.2 application?
-
You must wrap your Tcl scripts with Tcl/Tk8.0.3 interpreters (prowish80
and protclsh80). TclPro Checker can help you make your Tk 4.2 code
Tk8.0.3 compatible.
- 8.4.
Can wrapped applications run cross-platform?
-
No. Wrapped applications include a binary Tcl interpreter, which does
not run cross-platform.
- 8.5.
Can I wrap a Tcl application that runs in a custom Tcl interpreter?
-
Yes. Your custom interpreter must be based on Tcl/Tk8.0.3. You
need to build your custom interpreter using some libraries provided in
the TclPro installation. The demos/sampleApp directory of your TclPro
distribution contains an example of how to do this. Additionally, you
can follow the examples in Chapter 7 and the "Wrapping Applications
with a Custom Interpreter" section of Chapter 6 of the TclPro User's
Guide for more information.
If your custom interpreter requires dynamically loadable files, please
refer to questions related to dynamically loadable files in this section.
- 8.6.
Can I wrap dynamically loadable (DLL, .so or .sl) files?
-
RFE ID 455
You cannot wrap dynamically loadable files. This is because TclPro
Wrapper does not support the "load" command to load wrapped
.dll, .so, or .sl files. The "load" command cannot find files that
are wrapped inside your application because the "load" command is
implemented using operating system specific API calls. These APIs
expect the DLL file to be available in the context of the disk file
system and not wrapped files.
If you wrap the file foo.dll with a Tcl script containing the command
"load foo.dll", you will get the error "couldn't load file foo.dll:
invalid argument" when the wrapped application evaluates to "load"
call.
There are two ways to work around this issue:
1. Modify your Tcl code to copy the DLL from the wrapped application
to a temporary directory in the end-user's disk, and then use the
"load" command specifying the DLL in the temporary directory. Your
new Tcl code may look like the following:
set f [open goo.dll r]
fconfigure $f -translation {binary binary} -buffersize [expr {[file size _$file] + 1}]
set data [read $f]
close $f
set f [open c:/windows/temp/goo.dll w]
fconfigure $f -translation {binary binary}
puts $f $data close $f
load c:/temp/goo.dll
Please note that the wrapped application must use a dynamically linked
base application such as tclsh-dynamic or wish-dynamic. If you use
a statically linked base application such as tclsh or wish,
you receive an error that the load command is not supported
when executing the wrapped application. For additional information
about the required use of dynamically linked base applications,
please refer to additional questions in this section.
2. Statically link the code used to build the DLL directly with the
libraries provided with TclPro to create a custom Tcl
interpreter. The "load" command would not need to be used in this
case, but a "Tcl_AppInit()" routine would need to perform the
functionality of the "_Init()" routine from the DLL. Please refer
to the "Creating Base Application for TclPro Wrapper" section of
Chapter 7 in the TclPro User's Guide for more information on how to
build a base application for TclPro Wrapper.
- 8.7.
My application requires dynamically loadable (DLL, .so or .sl) files.
Can I use TclPro Wrapper to wrap my application?
-
When you invoke TclPro Wrapper with the -uses option and one of the
following predefined configurations: tclsh or wish, you are
wrapping your Tcl code with a statically linked base application.
This statically linked base application will have separate C runtime
libraries from the DLLs you plan to load. The use of different runtime
libraries (one in the base application and another in your DLL) in a
single application may result in memory corruption, causing erratic
behaviors in your wrapped application.
This problem can be circumvented by using a dynamically linked base
application which can share runtime libraries with DLLs. TclPro
Wrapper provides two dynamically linked base applications (tclsh-dynamic
or wish-dynamic) that you can use to build the application. When you
distribute your application, the DLLs that will be loaded should be
shipped together with the executable. This will require an installation
step to set up the application.
Starting with TclPro 1.1, the load command is no longer supported if you
wrap your application using a statically linked base application due to
the reason mentioned above. The following error message will be raised
if you use the load command in a statically linked wrapped application:
"load" command is not supported in a statically wrapped application;
use "load_unsupported" command
Please note that although you can use the load_unsupported command, it
is not recommended and will not be supported if you run into problems.
- 8.8.
Can end-users see the files in a wrapped application?
-
You can "hide" your Tcl code by compiling it before wrapping it. See
the compileAndWrap.tcl demo in the demos directory of your TclPro
release. As for hiding data files that you may wrap in your
application, TclPro does not include a way to "hide" these files unless
you turn the data files into Tcl code, where a variable is set to the
data inside of a procedure body. If you really need to hide them,
then you can encrypt the files and wrap a decryption mechanism with
your application.
- 8.9.
I want to wrap an application that reads and writes to a file. When I
include this file in my wrapped application, my application would
hang.
-
Files that are wrapped using TclPro Wrapper are read-only files. They
cannot be modified by the wrapped application. If your wrapped
application needs to both read and write to a file, we recommend that
you put the file in a known location on the file system and reference
this file using an absolute pathname to make sure that the application
will always access the correct file.
- 8.10.
My application uses the Opt package provided in the TclPro/lib/tcl8.0
directory. Why is this package not automatically included when I wrap my
application?
-
When you wrap your application, TclPro Wrapper does not automatically
include the Opt package. You have to explicitly wrap this package by
including files in the TclPro/lib/tcl8.0/opt1.0 directory in your
prowrap command.
- 8.11.
Can I use the Windows library files provided by TclPro with a Borland
compiler?
-
The Windows library files provided with TclPro are for Microsoft Visual
C++ 5.0 only. However, if you are using Borland compiler version 5.0,
you can linked with the DLL we provide. As for the .lib files, you can use
"implib" utility to generate a Borland compatible library from the DLL.
9. [incr Tcl] 3.0
- 9.1.
How can I use [incr Tcl], [incr Tk], and [incr Widgets] with protclsh80 or
prowish80?
-
You must first load the packages as follows:
package require Itcl
package require Itk
package require Iwidgets
It is a good practice to always prefix the commands and widgets with the
namespaces in which they reside. However, if you want to use the commands
and widgets without having to prefix each one with the corresponding
namespaces, you will have to import them into the global namespace
as follows:
namespace import -force ::itcl::*
namespace eval iwidgets {namespace export \[a-z\]*}
namespace import iwidgets::*
10. Expect 5.29
- 10.1.
Is Expect supported on Windows?
-
Expect is a supported extension on Unix only. If you need to use Expect
on Windows, you can download it from the following site:
http://bmrc.berkeley.edu/people/chaffee/expectnt.html
Please note that Expect is available with TclPro 1.2 and higher and
the Windows version is not supported by Scriptics.
|