v0.5.0
Highlights
A type-layer and resolution release: generated PHP now models C structs and
enums as first-class typed values, native-library resolution gained .tbd and
linker-script handling, and the toolchain footprint shrank to libclang only.
Structs & enums in the generated API
- Struct accessors. Each generated
Types\<tag>wrapper exposes typed
getField()/setField()accessors. Structs that embed another struct/union by
value now render too (decided by a render-time fixpoint over the genuinely
emittable aggregates), so a struct passed or returned by value works through
PHP FFI — quickjs'sJSValueround-trips by value end to end. - Enums. A C
enumbecomes an int-backed PHPenum. Parameters accept
Enum|int; a return is mapped back withEnum::tryFrom()(Enum|null).
Fewer external tools — libclang is the only requirement
- The export-symbol filter parses ELF / Mach-O / PE directly (the
object
crate) instead of shelling out tonm. This fixes a real failure on hosts without
binutils, where unexported declarations (SDL's app-providedSDL_main) leaked into
the cdef and brokeFFI::cdef. - Local git-origin lookup goes through libgit2; the only pkg-config use (a test) is
gone. Nonm,git, orpkg-configbinary is needed at install time.
Native-library resolution
- Ordered fallback chain.
library_namesis tried in order; avirtualentry
resolves to a real on-disk file when one exists (so the export filter can run) and
only falls back to a bare-name load when none does. - macOS
.tbdsupport. A newload_type(auto|elf|tbd|dll|dylib) plus a.tbd
parser lets macOS system libraries resolve through the SDK text stub for their
exports while the runtime loads the dylib by itsinstall-namefrom the dyld
shared cache. The active SDK is found viaxcrun/xcode-select. - Linker scripts / split libraries. A GNU ld linker script
(libncurses.so→INPUT(libncurses.so.6 -ltinfo)) is parsed and its inputs are
co-loaded, so a symbol split into a sibling.so(curses_versionin libtinfo)
resolves; a linker-script "exact match" is skipped in favour of the real soname.
Generator robustness
- A qualifier macro (
#define RESTRICT restrict) no longer leaks into a parameter. - An enum's own forward typedef no longer self-references when projected.
- An empty-
symbol_prefix(verbatim header) package still drops declarations the
library does not export (glibc'satexit, inlibc_nonshared.a).
Tooling
tests/docker-sweep/— a committed, build-once, single-foreground-container,
internally-parallelpnl install+EXAMPLES.mdsweep across Alpine and Ubuntu,
with agent rules for interpreting results.
Validation
Swept all packages without binutils on Alpine (musl) and Ubuntu (glibc): every
installable, non-hardware package's example runs, with zero cdef load-time errors
on both. The only remaining example failures are hardware-gated (an HID device, a
serial port). Rust (162) and PHP (65) suites green; clippy, php-cs-fixer, phpstan and
schema checks clean.