Determining the main routine

In Language Environment, only one routine can be the main routine. If a PL/I routine is identified as a main routine in an ILC application using PROC OPTIONS(MAIN) and a C main function does not exist, the PL/I main routine is the first to gain control. If a C main function exists, but no PL/I main routine is identified in the ILC application, the C main function gains control first.

If both a PL/I main routine identified by PROC OPTIONS(MAIN) and a C main function exist in the same ILC application, this is a user error. However, the error is not detected by Language Environment.

An entry point is defined for each supported HLL. Table 1 identifies the desired entry point. 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.
PL/I CEESTART CEESTART if OPTIONS(FETCHABLE) is used, or routine name.

When link-editing a PL/I module that is fetched, the name of the routine that is being fetched must be the entry point of the load module, unless the FETCHABLE option is specified on the PROCEDURE statement in the PL/I routine. When link-editing a C module that is fetched, the name of the routine being fetched must be the entry point of the load module, unless #pragma linkage (,fetchable) is specified in the C routine. You cannot have more than one entry point in an ILC application with #pragma linkage (,fetchable) or PL/I FETCHABLE option on the PROCEDURE statement. This error is not detected by Language Environment, but can cause unpredictable results.