Lahey/Fujitsu Fortran

Creating Applications and Libraries

Console Applications

LF95 creates Windows console-mode executables by default, so no options need be specified.



Windows UI Applications

To create a Windows UI application, either with a third-party package (such as Winteracter, GINO, or RealWin) or by calling the Windows API's directly, specify the -win option. To call the Windows API's directly, you must also specify the -ml winapi option See the Calling the Windows API for more information.

When resource files are specified on the command line, the resource compiler is invoked and the resulting .res file is linked with the application.

Note that console I/O is not permitted when using the -win option



Static Libraries

To create a static library, specify the library name using the -out option


LF95 mysub.f90 -out mylib.lib

LF95 recognizes that a library is requested because of the .lib extension for the output file. This causes LF95 to invoke the library manager rather than the linker. If the library specified with -out does not exist, it is created; if it already exists, it is updated.

Dynamically Linked Libraries

To create a 32-bit Windows DLL, use the -dll option


LF95 myprog.f90 -dll -win -ml msvc

In this example, the source file MYPROG.F90 contains procedures with DLL_EXPORT statements. The following takes place:

  1. MYPROG.F90 is compiled to create MYPROG.OBJ.
  2. MYPROG.OBJ is automatically linked with the LF95 runtime library to create MYPROG.DLL and MYPROG.LIB, the corresponding import library. Calling conventions in this case are those expected by Microsoft Visual C/C++.
For more information on DLLs, see Dynamically linked applications.