bytecodealliance / bytecodealliance/wit-bindgen

C Generator Panics on Case-Variant Function Names

Open
#1,411 4 comments 0 reactions 0 assignees View on GitHub
gen-c
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

### Summary

The C code generator in wit-bindgen panics with "duplicate symbols" error when processing valid WIT files that contain function names differing only in case.

### Environment

- **wit-bindgen version**: 0.47.0
- **Affected generator**: C
- **OS**: Ubuntu 22.04, x86-64

### Steps to Reproduce

1. Create a minimal WIT file

Save the following as `test.wit`:

```wit
package poc:demo;

world example {
export get-user: func() -> string;
export GET-USER: func() -> string;
}
```

2. Run wit-bindgen C generator

```bash
wit-bindgen c --out-dir /tmp/test test.wit
```

3. Observe the panic

```
thread 'main' panicked at crates/c/src/lib.rs:1899:38:
duplicate symbols: "name `exports_example_get_user` already defined"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

4. Verify Rust generator works correctly

```bash
wit-bindgen rust --out-dir /tmp/test_rust test.wit
```

Result: Successfully generates code without errors.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.