x11-rs
x11-rs copied to clipboard
Potential solution to older library versions with missing symbols
When gl_generator
's StructGenerator
attempts to load a missing function, it doesn't fail like x11-dl
currently does. Instead, it replaces the function with a panic wrapper with the same signature. This way a single missing function doesn't prevent the entire library from loading. I propose that we do the same thing in x11-dl
. This would make the Xrandr_2_2_0
struct in old_xrandr.rs obsolete, and it would prevent similar situations from happening in the future (whether they're likely to happen or not). In addition, a function can be added to check by name whether a symbol is available. If desired, I may have time to implement this some time in the next week.
Background: x11-dl
structures represent the public symbols exported by a shared object (like XOpenDisplay
from libX11.so.6
in a struct called Xlib
). If the library on the user's machine is missing even one of these symbols, the entire struct completely fails to initialize. IIRC, this happened on debian sid, making x11-dl
completely unusable on such systems.
I like this idea, make sense. Will look into this myself too, have not tried this against a debian sid base yet, still looking around things.