An alternative name for Metal C “main” function
JinYanChen 270001BY3P Visits (1059)
In C language the function "main" has special meanings and defined behaviors. In the compiler implementation, function "main" represents the triggering point for runtime initialization, but there might be needs to nominate an alternative entry point name for function "main" while maintaining the behavior of function "main".
Starting from z/OS V2R1, you can define an alternative entry point name for function "main" in Metal C programs using the "#pragma map" directive. For example, if you want to call your Metal C "main" function as "ANEWMAIN", add the following directive in your source file where "main" is defined:
#pragma map(main, "ANEWMAIN")
The entry point name in the generated prolog/epilog code will be ANEWMAIN. When you link your program, you need to tell the binder that the entry point name is ANEWMAIN.
Note that you can have only one "main" function in your Metal C program, , whether it is called "main" or otherwise, and the mapped entry point name for function "main" is also subject to the effect of the LONGNAME option.
Details about Defi