How to change the entry point of gcc compiler ?

I mean the code will look like the bellow one.

#include<stdio.h>
int entry()  //this is the new entry point instead of main.
{
return 0;
}

thank you very much..

Recommended Answers

All 2 Replies

I'm not sure if the gcc compiler has that option. The ld(GNU linker) can change the entry point label but its default is _start and it won't apply to your code.

ld

-e entry
--entry=entry
Use entry as the explicit symbol for beginning execution of your
program, rather than the default entry point. If there is no
symbol named entry, the linker will try to parse entry as a
number, and use that as the entry address (the number will be
interpreted in base 10; you may use a leading 0x for base 16, or
a leading 0 for base 8).

To expand on what gerard4143 mentioned, gcc has the option -Xlinker [i]option[/i] that allows you to pass options through to the linker.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.