Menu

Reference / Ffi

Weak

finalclass
final class Weak

Marks a binding whose C symbol may be missing on the current OS or target.

The reference is emitted as extern_weak, so a symbol absent at link time resolves to null instead of failing the link. The function must still never be called where the symbol is absent: guard calls with a runtime OS check. Use it together with {@see Symbol}, for example epoll_* (Linux only) referenced from a macOS build. A library reached only through weak bindings may be dropped from the link line by --as-needed.

See also: Symbol

View source