Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Tcl_FindExecutable (3tcl)

Name

Tcl_FindExecutable - identify or return the name of the binary file containing the application

Synopsis

#include <tcl.h>

void
Tcl_FindExecutable(argv0)

const char *
Tcl_GetNameOfExecutable()

Description

Tcl_FindExecutable(3tcl)    Tcl Library Procedures    Tcl_FindExecutable(3tcl)



______________________________________________________________________________

NAME
       Tcl_FindExecutable,  Tcl_GetNameOfExecutable  -  identify or return the
       name of the binary file containing the application

SYNOPSIS
       #include <tcl.h>

       void
       Tcl_FindExecutable(argv0)

       const char *
       Tcl_GetNameOfExecutable()

ARGUMENTS
       char *argv0 (in)          The first command-line argument to  the  pro-
                                 gram, which gives the application's name.
______________________________________________________________________________


DESCRIPTION
       The  Tcl_FindExecutable  procedure  computes  the full path name of the
       executable file from which the application was invoked and saves it for
       Tcl's  internal  use.  The executable's path name is needed for several
       purposes in Tcl.  For example, it is needed on some  platforms  in  the
       implementation  of  the  load command.  It is also returned by the info
       nameofexecutable command.

       On UNIX platforms this procedure is typically invoked as the very first
       thing  in the application's main program;  it must be passed argv[0] as
       its argument.  It is important not  to  change  the  working  directory
       before  the  invocation.   Tcl_FindExecutable uses argv0 along with the
       PATH environment variable to find the application's executable, if pos-
       sible.  If it fails to find the binary, then future calls to info name-
       ofexecutable will return an empty string.

       On Windows platforms this procedure is typically invoked  as  the  very
       first  thing  in  the  application's  main program as well; Its argv[0]
       argument is only used to indicate whether the executable has  a  stderr
       channel  (any  non-null  value) or not (the value null). If Tcl_SetPan-
       icProc is never called and no  debugger  is  running,  this  determines
       whether  the  panic  message  is sent to stderr or to a standard system
       dialog.

       Tcl_GetNameOfExecutable simply returns a pointer to the  internal  full
       path  name  of  the  executable file as computed by Tcl_FindExecutable.
       This procedure call is the C API  equivalent  to  the  info  nameofexe-
       cutable  command.   NULL is returned if the internal full path name has
       not been computed or unknown.


KEYWORDS
       binary, executable file



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tcl-8    |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source was downloaded from  http://prdownloads.sourceforge.net/tcl/tcl-
       core8.6.7-src.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



Tcl                                   8.1             Tcl_FindExecutable(3tcl)