Poke around and see if you can figure out how it was done
It currently relies on x11 but I’m hoping to make it work natively on wayland as well. I haven’t tested it but it should work even if you’re on a system that uses “exotic” runtime loader locations (cough nixos). I’m curious what theories people come up with or alternative approaches people might have.
I am guessing you manually load it at runtime, searching possible library paths. Andrew himself did exactly that a while ago, with vulkan too (maybe it was opengl?), unfortunately his binary no longer works last I checked
Correct me if I’m wrong, but it appears that this approach produces a static binary that will only work with glibc. It fails to run on my musl-based distro, and the project won’t build due to the libc runtime so names being different. Andrew’s old zig-window binary still runs fine on my system.
My take on this is this project, which implements a dynamic loader for linux x86_64. It works with glibc and musl, since the system libc is loaded like any other dynamic library when loading dependencies. I have been reporting progress in this thread. There is also an x11 + vulkan example. I am currently using it, as I recently started working on a desktop app framework that produces very portable static libc-free executables that work with X11 or Wayland and CPU or GPU rendering. Having dlopen in zig unleashes a lot of use cases.