January 15, 2026

Kyu - network - weak functions

The idea here is to provide a default function which can be overriden by a "regular" (global) function. This is handled at links time. If there is just a weak function of a given name, it gets used. If there are both a weak and a regular function with the same name, the regular function gets used.

You define a weak function like so:

void my_callback(void) __attribute__((weak));
This kind of annotation is called a "function attribute".


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org