Intel® Fortran Compiler 16.0 User and Reference Guide

Using Fortran Dynamic-Link Library Projects

A dynamic-link library (.DLL) is a source-code library that is compiled and linked to a unit independently of the applications that use it. A DLL shares its code and data address space with a calling application. A DLL contains only subprograms, not main programs.

A DLL offers the organizational advantages of a static library, but with the advantage of a smaller executable file at the expense of a slightly more complex interface. Object code from a DLL is not included in your program's executable file, but is associated as needed in a dynamic manner while the program is executing. More than one program can access a DLL at a time.

When routines in a DLL are called, the routines are loaded into memory at run-time, as they are needed. This is most useful when several applications use a common group of routines. By storing these common routines in a DLL, you reduce the size of each application that calls the DLL. In addition, you can update the routines in the DLL without having to rebuild any of the applications that call the DLL.

With Intel® Fortran, you can use DLLs in two ways:

  1. You can build a DLL with your own routines. In Visual Studio*, select Dynamic-link Library as your project type. From the command line, use the DLL option with the ifort command.

  2. You can build applications with the run-time library stored in a separate DLL instead of in the main application file. In the integrated development environment, open a solution and do the following:

    • From the Project menu, select Properties to display the project properties dialog box.

    • Click the Fortran folder.

    • Select the Libraries category.

    • In the Runtime Library option, select an option ending with "DLL."

    From the command line, use the libs compiler option with keyword dll to build applications with the run-time library stored in a separate DLL.

See Also