[En-Nut-Discussion] Nut/OS Initialization

Thiago A. Corrêa thiago.correa at gmail.com
Wed Sep 17 18:16:10 CEST 2008


Harald,

> Nathan Moore wrote:
>> I suspect that the case of automatically hooking in the call back functions
>> if they are implemented is done by way of having alternate implementations
>> of those functions in libraries with the like order (or priority) arranged
>> so that
>> if you didn't write your own the default is pulled from the library, and the
>> default doesn't actually do anything.
>
> You mean some kind of weak definition, like we use it for interrupt
> vectors. Mh...smart attempt.
>
> However, that would mean for Nut/OS, that we waste a lot of valuable RAM
> for the default structures.
>

I suspect that Nathan is right, as I have seen empty implementations
on the lib, that get's ignored by the new application level
implementations. Sort of virtual functions with the linker I guess
*smile*
It probably exploits the link order, .o files from the application
links first than the .a from the lib as Nathan explained. I haven't
seen in their code anything much special other than that.

Since we already redefine main to NutMain or something like that to
run code before main, I don't see this being in violation with C
(unless the linker thing is).

But I don't think it would make any difference in RAM usage than it is
currently.

Kind Regards,
    Thiago A. Correa



More information about the En-Nut-Discussion mailing list