Hi all, want to share a project I have been working on for the last several weeks: static dynamic - the single header library to allow static binaries to get access to the dynamic loader (aka be able to dlopen dynamic libraries like gpu drivers from a static binary). Even though it is written in C, it integrates pretty well with Zig as well (there is an important caveat about std.Thread usage though, so read the README for more info).
There is an example binary that loads raylib and draw things on the screen and I also integrated it with one of my other projects (fornax)(which is the original reason why I even implemented all of this) just to see how well it works with somethings a bit bigger than a single file example.
In the very beginning I did try to implement this in Zig and I even got some version of it working, but then I decided to switch to C for a broader compatibility. Since Zig has really good C integration, it is very simple to use this lib with it.
AI / LLM usage disclosure
Since my knowledge of Elf files and dynamic linker requirements was limited at the time, I did use ai to help me out with the research. Also I used it to help me find bugs in my previous attempts (this project is ~4th version of the lib)