Lahey/Fujitsu Fortran 95
The developers of Lahey/Fujitsu Fortran 95 (LF95) did an excellent job in making their compiler easy to use in a mixed-language development environment.
To indicate that a subroutine should be exported to a DLL you add the DLL_EXPORT directive to the subroutine declaration. For example:
subroutine MySub(argument1, argument2)
DLL_EXPORT MySub
The compiler directive DLL_EXPORT not only indicates that subroutine MySub is to be exported into a DLL, it also indicates the external name of the procedure. The subroutine becomes publicly available with the name that follows DLL_EXPORT. The directive preserves the case of the external name, so DLL_EXPORT MySub and DLL_EXPORT MYSUB produce different external names for the exported procedure.
To create the DLL you compile with switch –dll. To indicate the standard calling convention you use the switch –ml msvb. The following command-line would compile and link MySub.f90 (containing subroutine MySub) into MySub.dll callable from Visual Basic:
lf95 MySub.f90 -dll -win -ml msvb