[En-Nut-Discussion] Nut/OS Initialization
Nathan Moore
nategoose at gmail.com
Wed Sep 17 18:54:24 CEST 2008
On Wed, Sep 17, 2008 at 12:29 PM, Harald Kipp <harald.kipp at egnite.de> wrote:
>
>
> If you override weakly defined default structures, these defaults will
> not appear in the final code. If you don't override them, the defaults
> will be linked in. Empty would mean in this case, that they are zeroed
> out, but still occupy space.
>
> After writing this I got the strong feeling of having missed something.
> Possibly it has to do with link pointers....
>
>
Well the simplest thing I was imagining was:
some OS lib source:
...
x = GetThing(thing_dev);
if (user_callback(x) ) {
/* user does not like thing!! */
} else {
/* process thing */
}
...
some other OS lib source:
int user_callback(struct thing * th) {
return 0;
}
Then if the application didn't define a user_callback symbol the linker
would still have it in it's list of unresolved symbols
as it was searching the last of the libraries.
It's similar to the IpFilter *f() except doesn't require the pointer or the
check, and you could probably get away with
aliasing one default callback function as multiple call backs so you don't
end up a bunch of code that not only does
nothing, but does the exact same nothing -- just have one copy of it with as
many names as needed.
Nathan
More information about the En-Nut-Discussion
mailing list