z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Determining the main routine

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

In Language Environment, only one routine can be the main routine; no other routine in the enclave can use syntax that indicates it is main.

A C function is designated as a main routine because its function definition gives its name as main. The entry point into the load module is CEESTART. In C, the same routine can serve as both the main routine and subroutine if it is recursively called. In such a case, the new invocation of the routine is not considered a second main routine within the enclave, but a subroutine.

A Fortran routine is designated as a main routine with a PROGRAM statement, which indicates the name of the main routine. A main routine can also be designated by the absence of PROGRAM, SUBROUTINE, or FUNCTION statements, in which case the name of the main routine is the default value MAIN (or MAIN# for VS FORTRAN Version 2 Releases 5 and 6). The name of the main routine is the entry point into the load module.

An entry point is defined for each supported HLL. Table 1 identifies the main and fetched entry points for each language. The table assumes that your code was compiled using the Language Environment-conforming compilers.

Table 1. Determining the entry point
HLL Main entry point Fetched entry point
C CEESTART CEESTART or routine name, if #pragma linkage(,fetchable) is not used.
Fortran Name on the PROGRAM statement. In the absence of PROGRAM, SUBROUTINE, or FUNCTION statements, the default value is MAIN (or MAIN# in VS FORTRAN Version 2 Releases 5 and 6). Subprogram name

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014