When building a Metal C program, you might need to define an alternative
entry point name for function "main" while maintaining
all the characteristics of function"main".
For example, if you want to call your Metal C
"main" function
as
"ANEWMAIN", you can add the following directive
in your source file where
"main" is defined:
#pragma map(main, "ANEWMAIN")
void dosomething(char *);
int main(int argc, char *argv[]) {
int i;
for (i=1; i<argc; i++) {
dosomething(argv[i]);
}
return 0;
}
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.
For example:
/bin/ld -o a.out a.o -e ANEWMAIN
Notes: - In your C program, you can have only one "main" function,
whether it is called "main" or otherwise. If you
use IPA, IPA will terminate with an error message issued when more
than one "main" function is detected.
- The mapped entry point name for function "main" is
subject to the effect of the LONGNAME option. If the NOLONGNAME option
is in effect, the mapped name will be truncated to maximum of 8 characters,
and the name will be in upper case, with "_" in the
name converted to "@". For example, "a_newmain" will
become "A@NEWMAI".