[En-Nut-Discussion] GCC and main

Harald Kipp harald.kipp at egnite.de
Wed Jan 27 10:36:24 CET 2010


Nathan Moore wrote:

> I was just saying that I don't take advantage of the macro main because I prefer
> calling it something else, and it avoids confusion with __func__, objdump, and
> debugging.

Good objection. In a way this further supports my view as well, having
"main" as a real name for the application's entry point.

Let me suggest this solution:

#if !defined(NUT_ENTRY_main)
#define main NutAppMain
#endif

and add NUT_ENTRY_main to the Configurator (disabled by default). In the
idle thread we use

#if defined(NUT_ENTRY_main)
NutThreadCreate("main", main, 0, NUT_THREAD_MAINSTACK);
#else
NutThreadCreate("main", NutAppMain, 0, NUT_THREAD_MAINSTACK);
#endif

By default, NUT_ENTRY_main is not defined, which keeps the current
situation.

If NUT_ENTRY_main is defined, NutAppMain is fully replaced by main.

Harald





More information about the En-Nut-Discussion mailing list