| ... | @@ -348,7 +348,7 @@ pub const WindowsDynLib = struct { | ... | @@ -348,7 +348,7 @@ pub const WindowsDynLib = struct { |
| 348 | | 348 | |
| 349 | pub fn lookup(self: *WindowsDynLib, comptime T: type, name: [:0]const u8) ?T { | 349 | pub fn lookup(self: *WindowsDynLib, comptime T: type, name: [:0]const u8) ?T { |
| 350 | if (windows.kernel32.GetProcAddress(self.dll, name.ptr)) |addr| { | 350 | if (windows.kernel32.GetProcAddress(self.dll, name.ptr)) |addr| { |
| 351 | return @ptrCast(T, addr); | 351 | return @ptrCast(T, @alignCast(@alignOf(@typeInfo(T).Pointer.child), addr)); |
| 352 | } else { | 352 | } else { |
| 353 | return null; | 353 | return null; |
| 354 | } | 354 | } |
| ... | @@ -382,7 +382,7 @@ pub const DlDynlib = struct { | ... | @@ -382,7 +382,7 @@ pub const DlDynlib = struct { |
| 382 | // dlsym (and other dl-functions) secretly take shadow parameter - return address on stack | 382 | // dlsym (and other dl-functions) secretly take shadow parameter - return address on stack |
| 383 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826 | 383 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826 |
| 384 | if (@call(.never_tail, system.dlsym, .{ self.handle, name.ptr })) |symbol| { | 384 | if (@call(.never_tail, system.dlsym, .{ self.handle, name.ptr })) |symbol| { |
| 385 | return @ptrCast(T, symbol); | 385 | return @ptrCast(T, @alignCast(@alignOf(@typeInfo(T).Pointer.child), symbol)); |
| 386 | } else { | 386 | } else { |
| 387 | return null; | 387 | return null; |
| 388 | } | 388 | } |