This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: Auto initialisation of packages
Jonathan Larmour wrote:
>
> Nope. That's not quite right. Said static object would not be included
> unless it is directly referenced from an object that the user in turn
> references from somewhere else in their program.
>
> Think about how you would get a reference to the "C library object" if the
> users program was just:
[snip]
Ha! I talked myself round in circles - on the one hand I was saying that the
device driver approach referenced too many things, and on the other I was
saying it didn't reference enough.
After Bart knocked some sense into me, things are a bit clearer now - the
solutions have the same effect and overheads, they both cause initialization
iff the package is enabled - even in applications that don't use the
package's functionality.
The closest thing to a "solution" I could think of is to magically generate
a reference to the initialization object from each function and variable in
every object in the package. Even that wouldn't solve the particular
"main()" counterexample I mentioned. So the device driver approach *is* the
way to go.
So I'll pack my bags and go home now...
Jifl