function pointers and callbacks

This commit is contained in:
2026-06-15 21:09:46 +02:00
parent 3b7c3fcbd0
commit f5605fd3ec
21 changed files with 1927 additions and 122 deletions
+9 -6
View File
@@ -24,7 +24,9 @@
- information-preserving and information-forgetting pointer-to-array decay and sentinel slice/pointer weakening; array values never implicitly decay
- narrow immutable zero-terminated byte pointer conversion to `*c_char` and `[*;0]c_char`, without general `u8`/`c_char` interchange
- optionals with trapping postfix `?`, `orelse`, and nullable pointer representation
- source-order native structs, keyed literals, and defined or opaque pointer-only `c_struct`
- source-order native structs, defined or opaque `c_struct`, and keyed record literals
- complete plain imported C structs and unions as runtime values; incomplete or unsupported-layout records remain pointer-only
- C function pointer types as pointer-sized runtime values, including manual `*c_func(...) T` spelling and nullable imported callback typedefs
- postfix pointer dereference, general writable locations, function calls, assignments, and returns
### functions and packages
@@ -33,12 +35,13 @@
- bodyful `c_func` definitions using the c calling convention
- bodyless `c_func` declarations with exact, globally unique external symbol names
- concrete-only foreign signatures
- Apple Silicon C ABI scalar and pointer lowering, including narrow integer extension attributes
- Apple Silicon C ABI scalar, pointer, and fixed-signature plain record/union lowering, including narrow integer extension attributes
- directory packages with merged declarations
- file-local relative imports, aliases, and qualified member access
- relative `.h` imports as synthetic package namespaces
- transitive external C function prototypes, typedef chains, C scalars, and pointers to opaque C records
- transitive external C function prototypes, typedef chains, C scalars, fixed arrays, complete plain records/unions, and pointers to opaque C records
- bodyless manual and imported C variadic declarations with target-aware default argument promotions
- passing concrete `c_func` declarations/definitions as C callback values and calling non-null C function pointers with postfix call syntax
- reference-time diagnostics for unsupported imported C declarations
### compiler behavior
@@ -60,9 +63,9 @@
### scalar and compound types
- tuples and native variadic functions
- C unions, C enums, and by-value C record ABI lowering
- C enums and non-plain C record layouts
### advanced c imports
- C enums, external variables, function pointers, callbacks, macros, and static inline functions
- target-specific by-value C record and union ABI lowering
- C enums, external variables, macros, and static inline functions
- additional target-specific C ABI lowering