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 Visual Fortran, you can use DLLs in two ways:

  1. You can build a DLL with your own routines. In the visual development environment, select Fortran Dynamic-Link Library as your project type. From the command line, use the /DLL option with the DF 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 visual development environment, after you open a workspace:

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

For more information about DLLs, see: