Re: Startup function before main.

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

 



On 3/27/06, Uday Karan <uday.karan@xxxxxxxxx> wrote:
> I really don't understand what is the need to have a
> initialization/start up routine before main().  Main is just like any
> other function except that it works as a default entry point to which
> the glibc start up code makes a call to.
>
> You can have a function main() as your start up routine that calls
> your application's main functions app_main() or something similar.
> You can do all your start up code in main itself and then call
> app_main().
>
> Simulating what you are trying to achieve here should not be very
> difficult.  You can tweak your environment and stuff in main().

init-like constructors can be very helpful in some situations, like
profiling.  It allows for preparation of the environment, loading of
libraries and the like.  Doing that when main() has already been
called is not sufficient in these cases.

	\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