Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how to change the entry point in gcc (http://www.go4expert.com/forums/change-entry-gcc-t26749/)

asitmahato 21Sep2011 08:27

how to change the entry point in gcc
 
How to change the entry point of gcc compiler ?

I mean the code will look like the bellow one.
Code:

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

thank you very much..

poornaMoksha 21Sep2011 13:34

Re: how to change the entry point in gcc
 
try -e option of gcc..may be this could help

xpi0t0s 30Sep2011 14:44

Re: how to change the entry point in gcc
 
Not a good idea unless you deliberately want to obfuscate your code. Instead try this:
Code:

int main()
{
  return entry();
}

then continue as previously, coding from entry().

poornaMoksha 30Sep2011 14:55

Re: how to change the entry point in gcc
 
Yup not a good idea but the question was to change the entry point so that we do not have to keep main() in it. Is there a more elegant way other than using -e option??

xpi0t0s 30Sep2011 15:14

Re: how to change the entry point in gcc
 
Changing the entry point of a C program to anything other than main() fails ALL "elegance" tests. The best you can achieve is an ugly hack.

What's wrong with the -e option? Why doesn't it do what you want?


All times are GMT +5.5. The time now is 16:39.