Description
The #pragma weak directive adds an alternate function name with weak binding for the specified function.
Syntax
If the definition for the function function_name is not found, the linker resolves the function call to the definition for the function backup_function_name. If the definition for function_name is found, the linker resolves the function call to the definition for function_name.
If function_name is not referenced, neither function_name nor backup_function_name needs to be declared.
If the function_name is referenced, both function_name and backup_function_name must be declared.
backup_function_name can not be defined in the same compilation unit as the pragma.
![]()
Preprocessor Directives - An Overview
Preprocessor Directive - #pragma
