Displaying 1 result from an estimated 1 matches for "weakfn".
Did you mean:
weaken
2017 Oct 14
2
Weak undefined symbols and dynamic libraries
...e do not know that fact, and even for those who have
knowledge on ELF, the current half-broken behavior is confusing and not
useful. So I'd like to propose we simplify it.
Let me explain why it is half-broken. Assume that we have foo.c with the
following contents:
__attribute__((weak)) void weakfn(void) {}
int main() { if (weakfn) weakfn(); }
What it's intended to do is to call weakfn only when the function is
defined. If you link foo.o against a shared library providing a definition
of weakfn, the symbol is added to the executable's dynamic symbol table as
a weak undefined symbol...