Ftcl: Deployment issues

There are a few things to be aware of when you use Tcl/Tk in a Fortran program: The easiest way to get the program to work is to use a directory structure like the one shown below (for simplicity, shown as it appears on Windows):
                     ... (other scripts)
                        (message catalogues)
                    ... (scripts for the widgets)
Then set the PATH environment variable to include the directory ...\myprog\bin and, on Linux or UNIX, set the LD_LIBRARY_PATH environment variable to include that same directory.

Though you need to keep these files on the same computer as your program, there is no need to install Tcl/Tk on it: these files are enough.

Note: The Tcl libraries and script files do not need to be in the same directory as the program itself. The DLLs or shared libraries must be found in the path and the script files must be in a sibling directory of the directory holding the DLLs or shared libraries.

Some details about the C implementation

This section provides some information on the way the interface between the Tcl library (which is written in standard C) and Fortran is implemented.

C and Fortran both "mangle" the names of the routines. On some platforms the actual calling conventions differ too and other complications arise as well: these are all problems a programmer has to face when combining two different languages, but they can be relatively easy dealt with automatically.

This is up to a point: the C compiler has no knowledge of what Fortran compiler is used, and therefore some help must be provided - in the form of a C preprocessor macro.

Currently, Ftcl supports the following platforms:

  1. SUN Solaris with native compilers
  2. GNU C and g77 or g95 Fortran (all platforms)
  3. Windows with MSVC and Compaq Visual Fortran
  4. Windows with MSVC and Lahey Fortran
  5. Windows with MSVC and g95 Fortran
ad 1.
The SUN compiler is automatically recognised via the predefined macro "__sun".

ad 2.
The GNU C compiler is not automatically recognised:

ad 3,4,5.
On the Windows platform the MicroSoft Visual C/C++ compiler is often used, but for the Fortran compiler several options are possible with that C compiler. The C compiler in this case determines the name mangling and the calling convention. So, one macro, "WIN32", covers all possibilities.