Skip to content

Add --available-symbols to skip wrappers for unprovided functions#36

Open
yuiseki wants to merge 1 commit into
eliemichel:mainfrom
yuiseki:add-available-symbols-filter
Open

Add --available-symbols to skip wrappers for unprovided functions#36
yuiseki wants to merge 1 commit into
eliemichel:mainfrom
yuiseki:add-available-symbols-filter

Conversation

@yuiseki

@yuiseki yuiseki commented Jun 12, 2026

Copy link
Copy Markdown

What this does

Adds an optional --available-symbols FILE flag. The file lists the wgpu* C symbols actually provided by the library you link against (one per line, leading underscore optional). Procedures whose underlying C function is not in the list are skipped during generation, so the wrapper only references symbols that exist at link time. It reuses the same skip path as the existing blacklist.

Compatibility

Fully backward compatible. The flag is opt-in and defaults to off; an empty or missing file disables filtering. Without it, output is byte-for-byte identical to before.

Why it's needed

The WebGPU header declares the full spec surface, but a backend like wgpu-native implements only a subset (e.g. external textures and the mapped-range helpers are declared but not implemented). The WEBGPU_CPP_IMPLEMENTATION TU then emits references to those absent functions, which become unresolved wgpu* symbols when linking statically (for us, bundling into an amalgamation). Today the only workaround is to maintain a hand-written blacklist that drifts every time the header is updated. --available-symbols derives the exclusions automatically from the target library (e.g. nm), so it stays correct across backend and header versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant