Pieter said:
On 30 Jul 2003 02:34:56 -0700
Yes, we can, but how it's done is linker-specific. Arguments -e and --entry for
the GNU linker, for example. Try the newsgroup for your compiler, or read
it's documentation.
Er...
On GNU/Linux the default entry point for an ELF executable is named
_start, which is library function contained in libgcc_s (or sometimes
libc on older systems). _start hoiks the command and arguments out of
the OS-defined ABI positions and reformats them to the correct C ABI
positions for argc, argv (and argp, but lets not talk about that), then
calls main.
A similar bit of sysabi-specific code deals with the return vale of main
(or the argument ot exit()), it's usually called _exit.
So in fact, yes you can define the entry point to any symbol you desire,
_but_ you will be replacing _start and not main, and you almost
certainly don't want to do that.
I'd personally go for either a wrapper main function, or quicker but
dirtier, adding -Dmyfun=main to the preprocessor flags (CPPFLAGS).
Phil