Repository navigation
Make X11 and Wayland libraries optional - #56
Merged
levovix0 merged 15 commits intoOct 6, 2026
Merged
Conversation
Use siwin_loadDynlibIfExists with importc aliases across optional bindings. Reuse the original X11 package types instead of a private copy, preserve nullable callable variables and the existing EGL and GLX call patterns, and restore unrelated formatting changes. Add loader and source compatibility regression coverage.
elcritch
force-pushed
the
fix/optional-platform-libraries
branch
from
October 5, 2026 19:11
d1f4213 to
43f6471
Compare
elcritch
marked this pull request as ready for review
October 5, 2026 20:24
This was referenced Oct 6, 2026
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.
Summary
A Linux/BSD binary built with both backends should start without requiring libraries for the unused backend. Load the X11, GLX, XRender, Xcursor, Xext, Wayland, xkbcommon, EGL, wayland-egl, and Vulkan entry points through optional runtime handles. Advertise available backends and raise an error when an unavailable renderer is requested.
siwin_loadDynlibIfExists, adding support for explicitimportcsymbol names.libdecor_new != nilavailability check.The C ABI corrections, their caller changes, and the 32-bit binding comments are isolated in the stacked follow-up PR. This PR keeps the existing binding signatures so the optional-loading change can be reviewed separately.
Validation
Rechecked the dynamic-loading-only branch with Nim 2.2.10 on FreeBSD:
tests/t_dynlib_loading.nimpassed with the default memory manager and--mm:refc: missing libraries/symbols, original and aliased symbol lookup, varargs, and existing public API call patterns.dlopenshim hiding the optional platform libraries passed startup, nil-pointer, availability, error, and cleanup checks.tests/t_opengl.nimandtests/t_event_loop.nimpassed on isolated Xvfb servers.nim check --os:linux --path:src src/siwin.nimpassed for amd64 and i386;git diff --check upstream/masterpassed.The i386 checks are compile-time checks only. Live Wayland rendering was not exercised because no compositor was available. ABI limitations of the original declarations remain for the follow-up to address.