Determining the main routine

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).

An entry point is defined for each supported HLL. Table 1 identifies the main and fetched entry point 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 Not supported
Fortran Name on the PROGRAM statement. In the absence of PROGRAM, SUBROUTINE, or FUNCTION statements, the default value MAIN (or MAIN# in VS FORTRAN Version 2 Releases 5 and 6) is used. Subprogram name