Add a small C ABI interoperability example
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Why
Wave supports stable `extern(c)` and `export(c)` boundaries and the compiler regression suite verifies native C ABI interoperability, but `examples/` does not contain a small user-facing project that shows the workflow end to end.
## Scope
Add a self-contained native C interoperability example under `examples/` using a small Wave source file, a small C source file, and a short README with the build commands.
Demonstrate both directions:
- Wave calls a C function declared with `extern(c)`;
- C calls a Wave function exposed with `export(c)`.
Use simple scalar arguments and return values so the example teaches the ABI boundary without introducing struct-layout or variadic-call complexity. Reuse the compiler's existing supported native link-input workflow rather than adding new build-system behavior.
## Completion criteria
- [ ] The Wave source passes `wavec check` independently.
- [ ] The documented commands compile the C helper and Wave source and produce a runnable native program on a supported CI host.
- [ ] The program verifies deterministic values in both Wave-to-C and C-to-Wave calls.
- [ ] The example does not depend on a third-party C library or network access.
- [ ] The README or examples index clearly distinguishes `pub` module visibility from `export(c)` ABI visibility.
Contributor guide
Research direction
Start with the existing compiler regression suite's native C ABI interoperability coverage and the layout of examples/. Run wavec check on a small Wave source, then follow the compiler's supported native link-input workflow for the documented C and Wave build commands. Done means the example demonstrates deterministic calls in both directions, runs without third-party dependencies or network access, and explains pub versus export(c).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100