4.30 weak Pragma

The IAR weak pragma makes the definition of a function or variable with external linkage a weak definition, alternatively, it creates a weak alias for another function or variable.

Suggested Replacement

There is no equivalent MPLAB XC8 pragma, but there is an attribute that performs a similar task.

Use the weak function attribute to have the declaration emitted as a weak symbol.

Caveats

There is no means of creating a weak alias for another function or variable.

Examples

Consider migrating IAR code such as:
#pragma weak foo
int foo;
to MPLAB XC8 code similar to:
extern int __attribute__((weak))foo;

Further Information

See the Function Attributes section in the MPLAB XC8 C Compiler User's Guide for AVR MCUs for more information on writing interrupt functions.