If you're using gcc, I found a thread that said you can use the -e
command-line parameter to specify a different entry point; so you could use func
as your entry point, which would leave main
unused.
Note that this doesn't actually let you call another routine instead of main
. Instead, it lets you call another routine instead of _start
, which is the libc startup routine -- it does some setup and then it calls main
. So if you do this, you'll lose some of the initialization code that's built into your runtime library, which might include things like parsing command-line arguments. Read up on this parameter before using it.
If you're using another compiler, there may or may not be a parameter for this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…