Silverfrost Fortran FTN95 - Features


Silverfrost Fortran takes almost all the features of FTN77 and moves them into the era of modern Fortran. Like FTN77, FTN95 is designed to give meaningful diagnostics at all stages of program development. Many features that were unique to FTN77 have been brought into FTN95 as you will see below.

Many people use Fortran because they have 'dusty decks' containing code that cannot easily be changed. Others prefer to program using some of the more traditional Fortran constructs (such as COMMON blocks). Such users will be glad to know that FTN95 does not just support these features, but contains innovative facilities (such as virtual common) to exploit them in a modern context.

Virtual Common

Let's face it, many existing Fortran programs use COMMON blocks. Often a COMMON block can contain one or a small number of large arrays. Often the programmer is uncertain how big to make these arrays, since small program runs may require relatively small arrays, whereas large runs may require many megabytes. The problem is that a large common block hogs memory even if it is not being used. FTN95 supports the concept of virtual common blocks. Using this facility, the linker binds a common block to a region of address space where memory is allocated on demand. This means that a single executable can handle problems of widely different sizes.

Simplified Linking

Silverfrost FTN95 Win32 generates the standard form of relocatable binary for the Windows platform, and so can be linked by the Microsoft linker. However, FTN95 Win32 comes with its own linker, SLINK, which can greatly simplify the process of program linking:

  • Many programmers never need to explicitly concern themselves with the linker. Using the /LGO or /LINK command-line options (or using our Plato IDE) it is possible to generate an executable file in one operation
  • Fortran source can contain 'LIBRARY' directives (or command line equivalents) so that the /LINK and /LGO options are not restricted to stand-alone programs
  • SLINK can examine a .DLL file and deduce the entry points that it contains. This means that it is possible to insert dynamic links into your executables without having the appropriate .LIB files available
  • Sometimes it is desirable to generate an executable that can use a dynamic link library if it is present and avoid it otherwise. SLINK has an option which delays the binding of DLL's until they are actually used. This enables a program to check for the existence of a DLL and avoid calling it if it is unavailable
  • SLINK will produce a valid executable program even if there are unresolved external references (which is often the case in programs under development). If a program calls an unresolved reference the FTN95 runtime system generates an error message which states the name of the missing routine (and enters the debugger if in use)


FTN95 is famous for its easy-to-use Win32 GUI builder - ClearWin+. This library comes as part of the standard run-time system for FTN95, and with it you can write simple Windows programs in a few tens or hundreds of lines of Fortran code (a simple 'Hello World' program takes 5 lines), or larger, fully featured GUI programs in a little more. GUI features are specified using format strings reminiscent of traditional Fortran I/O. Many of our customers have produced very complex GUI applications including graphics, tool bars, edit boxes, etc. using ClearWin+.

80-bit floating point calculations

FTN95 supports three sizes of floating point number:

  1. KIND=1,32-bit numbers which have approximately 7 decimal digits of precision
  2. KIND=2,64-bit numbers which have approximately 14 decimal digits of precision
  3. KIND=3,80-bit numbers which have approximately 19 decimal digits of precision

All three formats use the coprocessor hardware on x86 chip, and so there is no great speed penalty for operating in high precisions.

Because many Fortran programs were written many years ago before the Fortran 90 standard introduced 'KIND' specifiers, FTN95 has an option to force all single precision calculations (32-bit) into double (64-bit). Using this option, everything is converted - declarations, constants, specific intrinsic functions names (which derive from Fortran 66!) - so that most programs run unchanged at higher precision. This feature is particularly useful for running Fortran programs that were written on mainframes where the base precision was greater than 32-bits. A further option is available to promote all floating point calculations to 80-bit precision. Note: 80-bit calculations are not available in .NET or x64.

Simplified interface to C/C++, including Microsoft Visual C++

Many Fortran programmers have a need to access C/C++ routines. Unless such routines have been written with the Fortran programmer in mind, this can be difficult. For example, many C/C++ programs accept arguments by value (rather than using pointers or references), and string data is traditionally nul-terminated rather than being space padded, as is the case for Fortran. The C language is also case sensitive, and so can generate external names that a Fortran programmer cannot access. To deal with these problems FTN95 (like FTN77) has the concept of a C_EXTERNAL statement. These statements define an interface to a C routine which handles all these issues.

Copyright © 1999-2024 Silverfrost Limited