diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 13:27:15 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 13:27:15 +0000 |
| commit | 4a70e44f06e637762eec0fd875eb94b84c3f4037 (patch) | |
| tree | b2771f76e3da335276a8c3e96ce70c2cfe99e088 /tests/i/extern-c-struct/notes.md | |
| parent | eaad9c34403f05372c1544d7ef522c847dfea0ba (diff) | |
feat(codegen): accept pointers to C-struct records in EXTERN signatures
A TYPE record whose fields are all C types, C structs or pointer types to
C structs now crosses the EXTERN "C" boundary through a pointer type.
Records by value are rejected for now, and a pointer to a record with a
non-C field names that field.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/i/extern-c-struct/notes.md')
| -rw-r--r-- | tests/i/extern-c-struct/notes.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/i/extern-c-struct/notes.md b/tests/i/extern-c-struct/notes.md new file mode 100644 index 0000000..1a0d215 --- /dev/null +++ b/tests/i/extern-c-struct/notes.md @@ -0,0 +1,7 @@ +# extern-c-struct + +Human review: pending. Expected output was independently traced by AI, not captured from cpsc. + +Basis: compiler extension (EXTERN "C", INCLUDE_OBJ of a user object); a record whose fields are all C types has the layout of the matching C struct. + +Trace: the harness compiles `lib.c` with the host C compiler. Sample matches `struct Sample {char; double; int}`, including the padding after the char. S is 'S', 1.5, 5. scale_sample(^S, 3) multiplies the value through the pointer to 4.5 and leaves tag and count alone, so the first line is `S 4.500000 5`. shared_sample returns the address of the static struct in lib.c, initialised to 'G', 0.5, 7, giving `G 0.500000 7`. P^.Count <- 9 writes through that pointer into the C object, so shared_count() returns 9. |
