Microsoft KB Archive/77517

= Creating the FORTRAN Run-Time DLL and User DLL for OS/2 =

PSS ID Number: 77517

Article Last Modified on 5/4/2001

-

The information in this article applies to:


 * Microsoft FORTRAN compiler for OS/2 5.1

-



This article was previously published under Q77517



SUMMARY
This article describes how to create the FORTRAN run-time DLL (dynamic-linked library) for OS/2 and how to create a user-written DLL for OS/2.

The following files are referenced in this article: Filename     Description

LLIBFMT.LIB  FORTRAN static, self-contained run-time library for multithread support.

OS2.LIB      Library to support OS/2 calls.

FDLLOBJS.LIB Object files from FORTRAN run-time library used to              create a dynamically linked FORTRAN run-time library.

FDLLOBJS.DEF Definitions file containing entry points to the FORTRAN run-time library.

FRTEXE.OBJ   Startup code for FORTRAN run-time to be linked with all executables using FORTRAN DLLs.

FRTDLL.OBJ   Startup code for user-written FORTRAN DLL to be linked with all user DLLs.

FRTLIB.OBJ   Startup code for the FORTRAN run-time DLL, to be linked when creating FORTRAN run-time DLL.

the user.
 * FRTLIB.DLL Full FORTRAN run-time dynamic-linked library created by

library containing all FORTRAN run-time imports to the executable.
 * FRTLIB.LIB Resulting import library from full FORTRAN run-time

DIFFHLP.DEF  Support definitions file to create an import library for a dynamic-linked FORTRAN run-time library.


 * Not shipped with FORTRAN, created by the user.



Creating the FORTRAN Run-Time DLL
 Create a definitions file listing all desired exports to the FORTRAN run-time library. For the full run-time library support, just use the file FDLLOBJS.DEF shipped with FORTRAN 5.1. Create an imports library to correspond to the above definitions file. This can be done by using IMPLIB on the above definitions file. For the full run-time library support, just use the file FDLLOBJS.LIB shipped with FORTRAN 5.1. Create the FORTRAN run-time DLL (FRTLIB.DLL) by linking the above imports library with the DLL startup code (FRTLIB.OBJ), and the definitions file created in step 1. The following command line should be used to link the FORTRAN run-time DLL:

link FRTLIB.OBJ,FRTLIBDLL,,FDLLOBJS.LIB/NOE,FDLLOBJS.DEF

 Create the corresponding imports library to the FORTRAN run-time DLL (FRTLIB.LIB). This import library will contain references to the run-time external functions needed by the executable. The following command line should be used to create the import library:

implib FRTLIB.LIB FDLLOBJS.DEF DIFFHLP.DEF



Creating a User-Written DLL to Be Linked to a Main Program
The files referenced below are shipped with Microsoft FORTRAN version 5.10, see the packing list for their exact locations.

 Create a subroutine or function to be added to the user written dynamic-linked library. All functions that are available from the calling program need to have the [loadds] attribute on their definition. The file example for this is called FMTDLL.FOR.</li> Create a definitions file for the DLL containing exports into the DLL. The file example for this is FMTDLL.DEF.</li> Create a main program containing a call to the subroutine or function in the DLL. The program example for this is FMTMAIN.FOR.</li> Create a definitions file for the main program, containing imports to DLL routines. See FMTMAIN.DEF for an example of this file.</li> Produce the main program executable (FMTMAIN.EXE) by linking with the FORTRAN run-time DLL imports library (FRTLIB.LIB), the startup code for all DLL executables (FRTEXE.OBJ), and the main program's definition file (FMTMAIN.DEF). The following command line should used to compile the FORTRAN main program source code:

fl /MD FMTMAIN.FOR FRTEXE.OBJ FRTLIB.LIB FMTMIN.DEF

</li> Create the user-written DLL by linking its subroutines (FMTDLL.FOR) with its definitions file (FMTDLL.DEF), the startup code for all user-written FORTRAN DLLs (FRTDLL.OBJ), and the FORTRAN dynamic-linked run-time library (FRTLIB.LIB). The following command line should be used to compile the FORTRAN DLL source code:

fl /MD /FeFMTDLL.DLL FMTDLL.FOR FRTDLL.OBJ FRTLIB.LIB FMTDLL.DEF

</li> Put all DLLs in a directory within the OS/2 LIBPATH (FMTDLL.DLL, FRTLIB.DLL) and run the executable.</li></ol>

Additional query words: kbinf nofps 5.10

Keywords: KB77517

Technology: kbAudDeveloper kbFORTRAN510OS2 kbFortranSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.