all: instrument library loading

This commit is contained in:
Tristan Crawford 2024-12-31 17:21:47 -05:00 committed by Emi Gutekanst
parent c56d596ea9
commit 41ddd2249f
10 changed files with 41 additions and 16 deletions

View file

@ -274,7 +274,7 @@ const LibXkbCommon = struct {
pub fn load() !LibXkbCommon {
var lib: LibXkbCommon = undefined;
lib.handle = std.DynLib.open("libxkbcommon.so.0") catch return error.LibraryNotFound;
lib.handle = try mach.dynLibOpen("libxkbcommon.so.0");
inline for (@typeInfo(LibXkbCommon).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
@ -327,7 +327,7 @@ const LibWaylandClient = struct {
pub fn load() !LibWaylandClient {
var lib: LibWaylandClient = undefined;
lib.handle = std.DynLib.open("libwayland-client.so.0") catch return error.LibraryNotFound;
lib.handle = try mach.dynLibOpen("libwayland-client.so.0");
inline for (@typeInfo(LibWaylandClient).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);