Linking Libraries

Simply Fortran can handle the mechanics of linking to external libraries using two techniques. Each method offers advantages, which are explained below.

Adding Libraries to a Project

The first technique involves adding a library file directly to a Simply Fortran project. This process is identical to adding a source file to a project. First, select “Add File(s)…” from the Project menu. Using the file selection dialog, navigate to the library file for inclusion; generally speaking, the file should have a .a or .dll extension. Select the file and press Open button.

The library file should now be in the project. Libraries are binary files and cannot be edited in Simply Fortran.

Using Compiler Flags

Libraries can also be included using compiler flags. To include a library via compiler flags, the library’s directory must be added to the list of library search directories. From the Project Options dialog, select the “File Locations” category. After selecting the “Library Directories” tab, click the “Add…” button and select the containing directory from the dialog.

After adding the library’s directory to the list, the flag to link to the library must be entered. In the Project Options dialog, select the “Compiler Flags” category. The proper flag to link to the library must be added to the box labeled “Linker.” For example, if the library file were named libblas.a, enter the following:


In the example above, notice that the “lib” prefix was excluded because the Fortran compiler implicitly assigns this to the beginning of the library name.

See Also

Getting Started
Project Management
Project Options