[openbeosnetteam] Re: mbuf.h

> Oh, once again, here come globals variables *definitions* instead of *
> declarations* in a header file.... Pfff.

Is this not the first time?

> Okay, that's buggy, you're right:
> 
> - The end of mbuf.h should be:
> ...
> Notice the "extern", turning these miss-placed definitions into 
> declarations.

Okay, but all modules that include mbuf.h will want to link against something 
that *defines* those variables, but as they do not link against the core (where 
they are defined (mbuf.c belongs to the core, does it not?)) these variables 
are never defined.
Where is my mistake?

> Then, in mbuf.c these should be added at top:
> ...
> Where these *definitions* belongs.

That is the problem, IMHO. These variables will only exist in mbuf.o (or the 
core).

> > 2. Those variables are never assigned a value, though, the tcp and 
> > ipv4 modules use them.
> > Where do their values come from?
> 
> From mbuf.c::mbinit().

I think I do not understand. :)
I thought that mbinit() lives in the core. There is no copy of this 
initialization living in _each_ network module like tcp, etc.
Could you please explain to me why this will work?
Should not the declarations go into a private header in the core's directory?

> > Can tcp and ipv4 use them? Does this not result in undefined values 
> > for max_xxx?
> 
> No.

No to the first question? :))

> > and can I remove the current definitions from the header?
> > What about the other definitions like mbpool (or whatever they are 
> > called)?
> 
> See on top.
> Put shortly, yes you can and, please, feel free to do it :-)

Thank you. :)

Waldemar

Other related posts: