WP66: C libraries from their headers
State: Proposed · Done: 0 of 7 · Design note: docs/wp66-c-headers.md
Stages
- S1:
zeroextonu8,u16andbooleanparameters and results of adeclare function(#1755) - S2:
nish c-import: a header read through clang becomes a Nish module ofdeclare functions,declare classes, out classes and constants, with an override file and a list of what was not bound - S3: opaque classes: a field-less
declare classC can return, so one C pointer type is not passed where another is wanted - S4: fixed-length array fields in a
declare class - S5: a buffer paired with its count by name, with a count of any unsigned width
- S6: C callbacks: a top-level function named at the call, passed as a C function pointer (open question)
- S7: a package links a C library or C sources of its own, under
nish runand--link
Next
S1: §8, S1. S2 follows it. S3, S4, S5 and S7 do not depend on one another.
Open questions
What C may do with a callback: call it on another thread, after the registering call has returned, or with a panic unwinding through its frames (S6). §8, S6. The owner's other decisions, D1 to D7, are in §9.
Not planned
Variadic functions, function-like macros, unions, bitfields, long double, C++ headers, and an import of a header at compile time unless the note's S6 question is answered for it.

