manual c function interop

This commit is contained in:
2026-06-11 22:46:12 +02:00
parent 2a79010a57
commit a5ceb727c1
20 changed files with 725 additions and 74 deletions
+4 -13
View File
@@ -4,16 +4,7 @@
# milestones
1. manual c function interop
- separate calling convention, implementation, linkage, and link name
- allow bodyless `c func` declarations with exact external symbol names
- require concrete types in foreign signatures; inferred `int` is invalid
- emit LLVM `declare` for referenced foreign functions
- compile and link additional c sources, object files, and libraries through CLI options
- preserve bodyful, mangled, demand-monomorphized `c func` behavior
- verify end-to-end with an integer-only c function
2. interop type foundation
1. interop type foundation
- unsigned integers, floats, and target-dependent c scalar types
- keep binding mutability (`::` / `=`) separate from element or pointee mutability (`mut`)
- arrays and indexing
@@ -36,7 +27,7 @@
- `Some :: c struct`: opaque c-layout struct
- defer passing c structs by value until target ABI classification exists
3. restricted c header imports
2. restricted c header imports
- treat an imported header as a synthetic, file-local package namespace
- `import "relative/path/to/header.h"`
- `other :: import "relative/path/to/header.h"`
@@ -46,13 +37,13 @@
- diagnose unsupported declarations when referenced
- research libclang's c API behind a replaceable c importer boundary
4. c variadic calls
3. c variadic calls
- represent c variadics as a fixed parameter count plus a variadic flag
- apply c default argument promotions at call sites
- emit LLVM c-variadic declarations and calls
- keep native brolang variadics and tuple design separate
5. advanced c interop
4. advanced c interop
- by-value records and unions
- function pointers and callbacks
- external variables