changing entry point

hi...
just wanted to check how i can the entry point of a program...
i tried using the #pragma directive but it doesnt seem to be workin...

#pragma comment(linker,"/ENTRY:startupfunction")
#include<stdio.h>

void startupfunction()
{
	printf("in print\n");
	main();
}

int main()
{
	printf("in main\n");
	return 0;
}

You can't do that.

The C standard dictates that code (usually called _start ) create things like stdin, stdout, etc. It has to run BEFORE main() and after main(), since it called main(). In the "after" part _start calls the exit routines you declare in atexit(), for example. Then it executes image rundown code, closing stdin, etc.

You would have to replace _start and _exit and other code in the libc library with your own version. Then link your code against your special version of libc.

May I ask why you think you need this entrypoint?

i dont exactly need it... a friend of mine told me that it could be done with the pragma directive...

#pragma

is completely compiler dependent. It may well be that a compiler supports this feature.
The reason main() is a function is because it's called by something. That something has to run before main() can come into play.

oh now i get it... my friends more of a windows guy thats why maybe his compiler supports it...