Skip to content

Commit 576bcf1

Browse files
committed
Further improve panic detail when unable to locate a function
1 parent b615174 commit 576bcf1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/root.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ comptime {
5050
}
5151
}
5252

53-
fn panicLocateFunction(name: []const u8) noreturn {
53+
fn panicLocateFunction(path: []const u16, name: []const u8) noreturn {
5454
@branchHint(.cold);
55-
std.debug.panic("Failed to locate function {s}", .{name});
55+
std.debug.panic("Failed to locate function {s} in {s}", .{ name, std.unicode.fmtUtf16Le(path) });
5656
}
5757

58-
fn loadFunctions(dll: std.os.windows.HMODULE) void {
58+
fn loadFunctions(dll: std.os.windows.HMODULE, path: []const u16) void {
5959
inline for (comptime std.meta.fieldNames(ProxyFuncAddrs)) |field| {
6060
@field(proxy_func_addrs, field) = std.os.windows.kernel32.GetProcAddress(dll, field) orelse {
61-
panicLocateFunction(field);
61+
panicLocateFunction(path, field);
6262
};
6363
}
6464
}
@@ -110,7 +110,7 @@ pub fn loadProxy(module: std.os.windows.HMODULE) !void {
110110

111111
const handle = try std.os.windows.LoadLibraryW(sys_full_path);
112112

113-
loadFunctions(handle);
113+
loadFunctions(handle, sys_full_path);
114114
}
115115

116116
test {

0 commit comments

Comments
 (0)