EXEC Function Appnote Available with FORTRAN 5.x (75223)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN Compiler for MS-DOS 5.0

This article was previously published under Q75223

SUMMARY

The application note titled "EXEC Function for FORTRAN" contains a function similar to the SPAWNLP function. The SPAWNLP function, included in the Microsoft FORTRAN 5.0 and 5.1 packages, suspends program execution and spawns a child process while leaving the parent process in memory. When this child process terminates, control returns to the parent process. On the other hand, the EXEC function terminates the parent process, taking the parent process out of memory, and then spawns the child process. Upon termination of the child process, the program is completed.

This application note "EXEC Function for FORTRAN" can be obtained by calling Microsoft Product Support Services.

This application note is also available in the Microsoft Software Library.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The following is the text of the application note:
======================================================================
                    HF0221: FORTRAN EXEC Function
======================================================================
                                                   Revision Date: 8/91
 --------------------------------------------------------------------
| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
| ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
| Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
| PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
| accuracy and the use of this Application Note. This Application    |
| Note may be copied and distributed subject to the following        |
| conditions: 1) All text must be copied without modification and    |
| all pages must be included; 2) If software is included, all files  |
| on the disk(s) must be copied without modification [the MS-DOS(R)  |
| utility DISKCOPY is appropriate for this purpose]; 3) All          |
| components of this Application Note must be distributed together;  |
| and 4) This Application Note may not be distributed for profit.    |
|                                                                    |
| Copyright 1991 Microsoft Corporation. All Rights Reserved.         |
| Microsoft, MS-DOS, and the Microsoft logo are registered           |
| trademarks and Windows is a trademark of Microsoft Corporation.    |
 --------------------------------------------------------------------

Simulating the P_OVERLAY Function of _spawnlp with the Microsoft
FORTRAN Optimizing Compiler Versions 4.0, 4.01, 4.1, 5.0, and 5.1

Versions 4.0, 4.01, 4.1, 5.0, and 5.1 of the Microsoft FORTRAN
Optimizing Compiler do not support the option within the _spawnlp
function that allows a second user program to completely overwrite the
space used by the program that initiates it. The programs supplied
with this application note use a slightly different mechanism to
provide this missing functionality. The EXEC function works under the
DOS operating system only.

The following files are provided on the FORTRAN 4.0, 4.01, 4.1, 5.0,
5.1 EXEC Function disk included with this application note:

   Filename            Description of File
   --------            -------------------

   README.DOC          Text of application note.

   EXEC.INC            A FORTRAN INTERFACE file that must be included
                       in every source file calling EXEC.

   LV40EXEC.LIB        Large memory model library for version 4.0 and
                       4.01 containing the routines necessary to
                       perform an EXEC.

   MV40EXEC.LIB        Medium memory model library for version 4.0 and
                       4.01 containing the routines necessary to
                       perform an EXEC.

   LV41EXEC.LIB        Large memory model library for versions 4.1 and
                       5.0 containing the routines necessary to
                       perform an EXEC.

   MV41EXEC.LIB        Medium memory model library for versions 4.1
                       and 5.0 containing the routines necessary to
                       perform an EXEC.

   LV51EXEC.LIB        Large memory model library for version 5.1
                       containing the routines necessary to perform an
                       EXEC.

   MV51EXEC.LIB        Medium memory model library for version 5.1
                       containing the routines necessary to perform an
                       EXEC.

   TEST1.FOR           Program to test an EXEC. It is more than
                       300,000 bytes in size and will EXEC the TEST2
                       program, which is of similar size. The
                       intention is to show that the two programs,
                       TEST1.FOR and EST2.FOR, which cannot fit in
                       memory at the same time, can be executed
                       individually.

   TEST2.FOR           Program to be executed by TEST1.

Link the program that calls EXEC (TEST1 in this case) with the
appropriate library listed above. For example, when using FORTRAN 5.1
for the large memory model, the compile line should look as follows:

   fl test1.for LV51EXEC.LIB

This will compile TEST1.FOR and link it with the FORTRAN run-time
library in addition to the EXEC function library specified.

NOTE: TEST1 and TEST2 are completely independent of each other. They
can even be compiled with different memory models.
				

Modification Type:MinorLast Reviewed:8/4/2004
Keywords:kbdownload kbdownload kbfile kbinfo KB75223 kbAudDeveloper