Compiler options on a command line

FTN95 is a command line compiler and so can be invoked from a Command Prompt box.

The compiler reads programs from text files that have been created using a suitable ASCII text editor (like that included in Visual Studio). The text file can be specified as the first parameter to the FTN95 command as follows:

FTN95 <pathname> /CLR

Note that options may be abbreviated, but care should be exercised to ensure that the abbreviated form is unique.

When the /CLR switch is used the compiler makes .DBK files for .NET rather than Win32 .OBJ files. When <pathname> does not include an extension, the compiler searches for the file <pathname>.F95 (or .F90). Source files must have .F95 or .F90 as an extension, or be specified with an explicit extension. Any file name acceptable to the operating system can be used.

By default, files that have a .F95 or .F90 extension are assumed to be free format files whilst files that have a .FOR or .F extension are assumed to be fixed format files.

For example


compiles the program in the file MYPROG.F95 which is in the cur­rent directory whilst


compiles the file MYPROG.F95 in the directory C:\FTN\PROJECT\.

Only one source file name may be specified unless wildcards are used. For example:

FTN95 *.F95 /CLR

would compile all of the .F95 files in the current directory. In this case an explicit extension (like .F95) is essential.

If the program is contained within a single file it can linked to form a .NET executable by using /LINK.


When /CLR is not present /LINK is used to create a Win32 executable.

The /LINK option can also used to create a .NET DLL file or a .NET module (not to be confused with a Fortran module). For a Win32 platform (when /CLR is not present), /LINK can also be used to create a DLL or library.

For single program files there is also a load-and-go option:


This compiles, links and loads the program without creating permanent object and executable files.

If your project uses a number of source files, then each file must be separately compiled using a command of the form:


The resulting set of .DBK files are then linked together using the Salord linker DBK_LINK or DBK_LINK2 or DBK_LINK4. If /CLR is not used, the resulting set of .OBJ files are linked together using the Silverfrost linker SLINK.

FTN95 for Microsoft .NET does not have an independent debugger so you must use Visual Studio in order to step into the code for debugging purposes. FTN95 for Win32 uses either the independent debugger SDBG or can use the debugger inside Visual Studio.

Some of the compiler command line options can be adopted as compiler defaults. The default options can be listed and changed from an interactive dialog that is opened with the following command:


Many of the options have a corresponding opposite. For example /-INTL is the opposite of /INTL. If the default setting is changed by using the /CONFIG dialog, then there are occasions when you may wish to use the opposite option in order to temporarily restore the original default. The dialog indicates which options can be configured and hence have an opposite.



Copyright © 1999-2023 Silverfrost Limited