Ftcl: Using Tcl in Fortran programs and vice versa

Ftcl is meant to offer a simple and robust way of incorporating the Tcl/Tk language in a Fortran program. There are numerous advantages of using Tcl/Tk in such programs: For an overview of the latest developments: What's new?

The interfacing between Tcl and Fortran is fairly straightforward, but does require some explanation. One thing that may strike the Fortran programmer as odd, is the fact that the Fortran side can be used as a library of Tcl commands rather than as a program in full control.

You can in fact use the interface in two different ways:

The source code can be found on the SF project page.

If you are interested in the combination of Fortran and Tk to develop graphical user-interfaces, then have a look at the lander example. The cgi example illustrates a method to use Fortran programs in a CGI environment, complete with a simple HTTP server, written in Tcl.

Here is an overview of the documentation:
Calling Tcl procedures With Ftcl you can set and get variables in the Tcl interpreter, run individual commands or complete scripts
Creating extensions in Fortran Just as with C you can create an extension in Fortran that can be called from a Tcl program.
Aspects of deployment There are a few caveats that you should keep in mind - not every wrinkle is ironed out yet.
Manual page for Ftcl The manual page describes the public routines that you can use in your code.
Design considerations Should you be interested, here are some thoughts on the design.
Article on Ftcl in Fortran Forum This article was written for the Fortran Forum several years ago. It describes some of the examples still found in the distribution.
Article on Ftcl presented at the Tcl conference in 2004 This article was written for the Tcl conference. It contains work by Clif Flynt on incorporating Tk as well, so that you can build GUIs from within the Fortran code.


-- Arjen Markus, dd. august 2007