aboutsummaryrefslogtreecommitdiff
path: root/tests/i/extern-c-struct/lib.c
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 13:27:15 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 13:27:15 +0000
commit4a70e44f06e637762eec0fd875eb94b84c3f4037 (patch)
treeb2771f76e3da335276a8c3e96ce70c2cfe99e088 /tests/i/extern-c-struct/lib.c
parenteaad9c34403f05372c1544d7ef522c847dfea0ba (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/lib.c')
-rw-r--r--tests/i/extern-c-struct/lib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/i/extern-c-struct/lib.c b/tests/i/extern-c-struct/lib.c
new file mode 100644
index 0000000..39380ec
--- /dev/null
+++ b/tests/i/extern-c-struct/lib.c
@@ -0,0 +1,11 @@
+struct Sample {
+ char tag;
+ double value;
+ int count;
+};
+
+static struct Sample shared = {'G', 0.5, 7};
+
+void scale_sample(struct Sample *s, int k) { s->value *= k; }
+struct Sample *shared_sample(void) { return &shared; }
+int shared_count(void) { return shared.count; }