Macros to manage weak symbol definitions

Weak symbols allow one to reference a function in another file without necessarily requiring that file to be linked in. More...


Defines

#define __weak_impl(name)   _w_ ## name
 Mangle name into its weakly-referenced implementation.
#define __weak_decl(ret, name, proto, args, dfl)
 Declare a weak function with inline safety wrapper.


Detailed Description

Weak symbols allow one to reference a function in another file without necessarily requiring that file to be linked in.

In their native form, the function will be NULL if its file is not linked in; these macros provide an inline wrapper that returns an appropriate error indication or default value.


Define Documentation

#define __weak_impl ( name   )     _w_ ## name

Mangle name into its weakly-referenced implementation.

Definition at line 196 of file compiler.h.

#define __weak_decl ( ret,
name,
proto,
args,
dfl   ) 

Value:

ret __weak_impl( name ) proto __attribute__ (( weak )); \
        static inline ret name proto {                          \
                if ( __weak_impl( name ) )                      \
                        return __weak_impl( name ) args;        \
                return dfl;                                     \
        }
Declare a weak function with inline safety wrapper.

Parameters:
ret Return type of weak function
name Name of function to expose
proto Parenthesized list of arguments with types
args Parenthesized list of argument names
dfl Value to return if weak function is not available

Definition at line 207 of file compiler.h.


Generated on Tue Apr 6 20:01:58 2010 for gPXE by  doxygen 1.5.7.1