refactor(libghostty): restructure and harden native and Wasm C ABI bindings - #146
Merged
Conversation
elias8
force-pushed
the
refactor/libghostty-abi
branch
4 times, most recently
from
August 16, 2026 22:25
d7da3b3 to
3bb1779
Compare
elias8
force-pushed
the
refactor/libghostty-abi
branch
from
August 17, 2026 10:40
3bb1779 to
663e851
Compare
elias8
force-pushed
the
refactor/libghostty-abi
branch
from
August 17, 2026 11:06
663e851 to
451f4b0
Compare
elias8
marked this pull request as ready for review
August 17, 2026 11:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Redesign libghostty’s C ABI seam around focused native and Wasm bindings while preserving existing behavior and keeping platform details internal. Strengthen runtime layout, result, ownership, lifetime, callback, and memory safety; improve hot path allocation behavior; expose idiomatic public wrappers; and align ABI and behavioral tests with the shared native and Wasm contracts.
This change touches nearly every file in the libghostty package and is close to a complete internal rewrite, while preserving existing behavior and most of the public API. The public API was already in a good place, but the internals had not kept pace with the growth of the C ABI since the package’s initial implementation. I have wanted to do this refactoring for some time. The resulting structure gives each platform binding a clearer boundary, makes behavioral consistency between native and Wasm explicit and enforceable, and should make future ABI additions easier to implement and maintain.
I plan a few focused follow up PRs, mainly around the build system and further quality improvements.
Note: I planned and iterated on these changes myself, while using LLMs extensively for the mechanical implementation work.