Lahey/GNU Fortran

Declaring Calling Conventions

In order to reference a procedure across a DLL interface, the LGF compiler must be informed of the procedure name to be exported, and given a calling convention for the external names in your DLL.

The procedure names that will be externally available are defined with the !GCC$ ATTRIBUTES DLLEXPORT and !GCC$ ATTRIBUTES DLLIMPORT statements in the source code. Please note that procedure names appearing in a !GCC$ ATTRIBUTES DLLEXPORT or !GCC$ ATTRIBUTES DLLIMPORT statement are case sensitive (unlike the Fortran naming convention, which ignores case).

!GCC$ ATTRIBUTES DLLEXPORT is used to define an externally available DLL procedure.

!GCC$ ATTRIBUTES DLLIMPORT is used when referencing a DLL procedure.

The calling convention is defined when the -ML compiler option is specified. If you need to reference DLLs from multiple languages you can do so by putting the references in separate source files and compiling them separately.

LGF can build DLLs callable from Microsoft Visual Basic, however, Microsoft Visual Basic does not build DLLs callable by LGF. Assembly procedures may be called from Fortran procedures, however the use of DOS interrupts is not supported.

See Also

GNU Fortran compiler directives