| ... | @@ -104,7 +104,7 @@ pub const LinuxDynLib = struct { | ... | @@ -104,7 +104,7 @@ pub const LinuxDynLib = struct { |
| 104 | memory: []align(mem.page_size) u8, | 104 | memory: []align(mem.page_size) u8, |
| 105 | | 105 | |
| 106 | /// Trusts the file | 106 | /// Trusts the file |
| 107 | pub fn open(allocator: *mem.Allocator, path: []const u8) !DynLib { | 107 | pub fn open(path: []const u8) !DynLib { |
| 108 | const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC); | 108 | const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC); |
| 109 | errdefer os.close(fd); | 109 | errdefer os.close(fd); |
| 110 | | 110 | |
| ... | @@ -244,14 +244,12 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ | ... | @@ -244,14 +244,12 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ |
| 244 | } | 244 | } |
| 245 | | 245 | |
| 246 | pub const WindowsDynLib = struct { | 246 | pub const WindowsDynLib = struct { |
| 247 | allocator: *mem.Allocator, | | |
| 248 | dll: windows.HMODULE, | 247 | dll: windows.HMODULE, |
| 249 | | 248 | |
| 250 | pub fn open(allocator: *mem.Allocator, path: []const u8) !WindowsDynLib { | 249 | pub fn open(path: []const u8) !WindowsDynLib { |
| 251 | const wpath = try windows.sliceToPrefixedFileW(path); | 250 | const wpath = try windows.sliceToPrefixedFileW(path); |
| 252 | | 251 | |
| 253 | return WindowsDynLib{ | 252 | return WindowsDynLib{ |
| 254 | .allocator = allocator, | | |
| 255 | .dll = try windows.LoadLibraryW(&wpath), | 253 | .dll = try windows.LoadLibraryW(&wpath), |
| 256 | }; | 254 | }; |
| 257 | } | 255 | } |
| ... | @@ -273,7 +271,7 @@ test "dynamic_library" { | ... | @@ -273,7 +271,7 @@ test "dynamic_library" { |
| 273 | else => return, | 271 | else => return, |
| 274 | }; | 272 | }; |
| 275 | | 273 | |
| 276 | const dynlib = DynLib.open(std.debug.global_allocator, libname) catch |err| { | 274 | const dynlib = DynLib.open(libname) catch |err| { |
| 277 | testing.expect(err == error.FileNotFound); | 275 | testing.expect(err == error.FileNotFound); |
| 278 | return; | 276 | return; |
| 279 | }; | 277 | }; |