Re: Startup function before main.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/27/06, krishna.vamsi@xxxxxxxxx <krishna.vamsi@xxxxxxxxx> wrote:
> Hi List,
>
> Before Executing the main function, a startup routine will be executed
> which will set up the initial environment for the process.
>
> This Startup routine will be supplied by the kernel and linked by the
> Linker. My question is : Can we add one more startup routine before
> executing the main program, if yes how??

No, not programmatically, only by patching the executable or object file.
You can call other functions from within the constructor:

	void __attribute__ ((constructor)) my_ctor() {
		int i = my_func();
	}

You should not need a second constructor.  Who shall decide which one
comes first and how should it be done?

	\Steve
-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux