Ownership boundaries
What shipped bindings can safely show today.
UnFFI makes native calls typed. It does not automatically model native ownership rules. The shipped bindings favour symbols that return scalars, mutate caller-owned buffers, or expose metadata.
Safe categories
- Scalar returns such as
i32,u32,u64, andf64. t.cstringinputs that are encoded for the duration of one call.- Caller-owned
t.bufferoutputs such asSecRandomCopyBytesorGetUserNameA.
Metadata-only examples
Some symbols are exported but not used in introductory examples:
SCDynamicStoreCopyProxiesreturns an owned CoreFoundation object pointer.dlerrorreturns thread-local loader state that is only meaningful after a loader failure.
These pages document the schema and path metadata without encouraging unsafe pointer work.
Wait for wrappers
Avoid treating t.pointer returns as JavaScript objects. CoreFoundation Create/Copy APIs, COM objects, Objective-C messaging, structs by value, and callback-heavy APIs need higher-level wrappers that know when to retain, release, decode, or keep callbacks alive.
CoreFoundation exports CFRelease, but only call it on pointers you obtained from documented Create/Copy APIs and fully understand.