1Tcl_FindExecutable(3)       Tcl Library Procedures       Tcl_FindExecutable(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_FindExecutable,  Tcl_GetNameOfExecutable  -  identify or return the
9       name of the binary file containing the application
10

SYNOPSIS

12       #include <tcl.h>
13
14       void
15       Tcl_FindExecutable(argv0)
16
17       const char *
18       Tcl_GetNameOfExecutable()
19

ARGUMENTS

21       char *argv0 (in)          The first command-line argument to  the  pro‐
22                                 gram, which gives the application's name.
23______________________________________________________________________________
24
25

DESCRIPTION

27       The Tcl_FindExecutable procedure computes the full path name of the ex‐
28       ecutable file from which the application was invoked and saves  it  for
29       Tcl's  internal  use.  The executable's path name is needed for several
30       purposes in Tcl.  For example, it is needed on some  platforms  in  the
31       implementation  of  the  load command.  It is also returned by the info
32       nameofexecutable command.
33
34       On UNIX platforms this procedure is typically invoked as the very first
35       thing  in the application's main program;  it must be passed argv[0] as
36       its argument.  It is important not to change the working directory  be‐
37       fore the invocation.  Tcl_FindExecutable uses argv0 along with the PATH
38       environment variable to find the application's executable, if possible.
39       If  it  fails  to find the binary, then future calls to info nameofexe‐
40       cutable will return an empty string.
41
42       On Windows platforms this procedure is typically invoked  as  the  very
43       first  thing in the application's main program as well; Its argv[0] ar‐
44       gument is only used to indicate whether the  executable  has  a  stderr
45       channel  (any  non-null  value) or not (the value null). If Tcl_SetPan‐
46       icProc is never called and no  debugger  is  running,  this  determines
47       whether the panic message is sent to stderr or to a standard system di‐
48       alog.
49
50       Tcl_GetNameOfExecutable simply returns a pointer to the  internal  full
51       path  name  of  the  executable file as computed by Tcl_FindExecutable.
52       This procedure call is the C API  equivalent  to  the  info  nameofexe‐
53       cutable  command.   NULL is returned if the internal full path name has
54       not been computed or unknown.
55
56

KEYWORDS

58       binary, executable file
59
60
61
62Tcl                                   8.1                Tcl_FindExecutable(3)
Impressum