[U-Boot-Users] [PATCH] Functions added to extern for stand alone programs
Wolfgang Denk
wd at denx.de
Wed May 23 21:59:21 CEST 2007
In message <e68c55e80705231251s678d3e59g2db9ed3da3fce830 at mail.gmail.com> you wrote:
>
> > #define cond_extern(name) asm(".weak\t" #name "\n\t.set\t" #name ",
> > unimpl_extern")
>
> I do not understand what this does. Does it work?
Yes, it does. See file: gcc.info, node: Function Attributes,
section: 5.24 Declaring Attributes of Functions
> > static int unimpl_extern(void)
> > {
> > return -ENOSYS; /* or something more appropriate */
> > }
>
> How is this different that using the dummy function?
The main difference is that with "normal" functions you must make
sure that the dummy function does not get compiled / linked when you
implement a real function. "Weak" are simply overwritten if any user
provides another (real) function with the same name. No #ifdef mess
any more :-)
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm a programmer: I don't buy software, I write it.
-- Tom Christiansen
More information about the U-Boot
mailing list