Skip to content

Conversation

microo8
Copy link
Contributor

@microo8 microo8 commented Jan 23, 2022

Removing linking of libX11 and replacing it with dlopen to call the
functions dynamically.
For the future wayland support, the library will not require the libX11
library to be installed on the running system.
For compiling it we need it, because of the huge and complicated type
definitions, but the compiled binary will run also on a system without
libX11.

Maybe in the future we can eliminate also the X11/Xlib.h and X11/Xatom.h.
The only thing that really needs to be declared is the XEvent and it's attributes,
other things can be a void pointer or some c primitives.

Removing linking of libX11 and replacing it with dlopen to call the
functions dynamically.
For the future wayland support, the library will not require the libX11
library to be installed on the running system.
For compiling it we need it, because of the huge and complicated type
definitions, but the compiled binary will run also on a system without
libX11.

References: #6
Signed-off-by: Vladimír Magyar <[email protected]>
Copy link
Member

@changkun changkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quite interesting change. Thanks! I got some questions generally about this approach:

If we switch to dynamic load approach, and understood this correctly, we will get a Init error if libX11 is missing?

@microo8
Copy link
Contributor Author

microo8 commented Jan 24, 2022

So I changed it to load libX11 only once when calling a function. Tests are ok.

@changkun
Copy link
Member

Thanks, I'll merge it first and then dig more about this. After a quick inspection on the Go's plugin package, it turns out they are the exact same appraoch.

@changkun changkun merged commit 1d2e38d into golang-design:main Jan 24, 2022
@microo8
Copy link
Contributor Author

microo8 commented Jan 24, 2022 via email

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.

2 participants