authorgravatar for emekankurumeh@outlook.comemekoi <emekankurumeh@outlook.com> 2019-05-28 11:18:30-05:00
committergravatar for emekankurumeh@outlook.comemekoi <emekankurumeh@outlook.com> 2019-05-28 11:18:30-05:00
logf2b64fd18f73fe26934b388c1da95e1b4e770c83
tree4f7837273a36e5bf8a3f370a673045702c8380c8
parentb8cd4b18b068d83bd4c2ae44777f60244d8d1853

updated dynamic libraries to new std


1 files changed, 4 insertions(+), 12 deletions(-)

std/dynamic_library.zig+4-12
...@@ -105,8 +105,8 @@ pub const LinuxDynLib = struct {...@@ -105,8 +105,8 @@ pub const LinuxDynLib = struct {
105105
106 /// Trusts the file106 /// Trusts the file
107 pub fn open(path: []const u8) !DynLib {107 pub fn open(path: []const u8) !DynLib {
108 const fd = try std.os.posixOpen(path, 0, linux.O_RDONLY | linux.O_CLOEXEC);108 const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC);
109 errdefer std.os.close(fd);109 errdefer os.close(fd);
110110
111 const size = @intCast(usize, (try os.fstat(fd)).size);111 const size = @intCast(usize, (try os.fstat(fd)).size);
112112
...@@ -247,18 +247,10 @@ pub const WindowsDynLib = struct {...@@ -247,18 +247,10 @@ pub const WindowsDynLib = struct {
247 dll: windows.HMODULE,247 dll: windows.HMODULE,
248248
249 pub fn open(path: []const u8) !WindowsDynLib {249 pub fn open(path: []const u8) !WindowsDynLib {
250 const wpath = try win_util.sliceToPrefixedFileW(path);250 const wpath = try windows.sliceToPrefixedFileW(path);
251251
252 return WindowsDynLib{252 return WindowsDynLib{
253 .dll = windows.LoadLibraryW(&wpath) orelse {253 .dll = try windows.LoadLibraryW(&wpath),
254 const err = windows.GetLastError();
255 switch (err) {
256 windows.ERROR.FILE_NOT_FOUND => return error.FileNotFound,
257 windows.ERROR.PATH_NOT_FOUND => return error.FileNotFound,
258 windows.ERROR.MOD_NOT_FOUND => return error.FileNotFound,
259 else => return os.unexpectedErrorWindows(err),
260 }
261 },
262 };254 };
263 }255 }
264256