diff options
| author | emekoi <emekankurumeh@outlook.com> | 2019-05-28 11:18:30 -0500 |
|---|---|---|
| committer | emekoi <emekankurumeh@outlook.com> | 2019-05-28 11:18:30 -0500 |
| commit | f2b64fd18f73fe26934b388c1da95e1b4e770c83 (patch) | |
| tree | 4f7837273a36e5bf8a3f370a673045702c8380c8 | |
| parent | b8cd4b18b068d83bd4c2ae44777f60244d8d1853 (diff) | |
| download | zig-f2b64fd18f73fe26934b388c1da95e1b4e770c83.tar.gz zig-f2b64fd18f73fe26934b388c1da95e1b4e770c83.zip | |
updated dynamic libraries to new std
| -rw-r--r-- | std/dynamic_library.zig | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/std/dynamic_library.zig b/std/dynamic_library.zig index db5dffeefd..e55d6df84f 100644 --- a/std/dynamic_library.zig +++ b/std/dynamic_library.zig @@ -105,8 +105,8 @@ pub const LinuxDynLib = struct { /// Trusts the file pub fn open(path: []const u8) !DynLib { - const fd = try std.os.posixOpen(path, 0, linux.O_RDONLY | linux.O_CLOEXEC); - errdefer std.os.close(fd); + const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC); + errdefer os.close(fd); const size = @intCast(usize, (try os.fstat(fd)).size); @@ -247,18 +247,10 @@ pub const WindowsDynLib = struct { dll: windows.HMODULE, pub fn open(path: []const u8) !WindowsDynLib { - const wpath = try win_util.sliceToPrefixedFileW(path); + const wpath = try windows.sliceToPrefixedFileW(path); return WindowsDynLib{ - .dll = windows.LoadLibraryW(&wpath) orelse { - const err = windows.GetLastError(); - switch (err) { - windows.ERROR.FILE_NOT_FOUND => return error.FileNotFound, - windows.ERROR.PATH_NOT_FOUND => return error.FileNotFound, - windows.ERROR.MOD_NOT_FOUND => return error.FileNotFound, - else => return os.unexpectedErrorWindows(err), - } - }, + .dll = try windows.LoadLibraryW(&wpath), }; } |
