diff options
| author | Jimmi Holst Christensen <jimmiholstchristensen@gmail.com> | 2018-11-13 05:08:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-13 05:08:37 -0800 |
| commit | 8139c5a516eaa217ed76acdf09496895451c5c5c (patch) | |
| tree | 89841cec818c5650471c7f2c11141013f8640bf7 /std/dynamic_library.zig | |
| parent | 67fbb0434f7104801c66e821b5057a8323e377df (diff) | |
| download | zig-8139c5a516eaa217ed76acdf09496895451c5c5c.tar.gz zig-8139c5a516eaa217ed76acdf09496895451c5c5c.zip | |
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
Diffstat (limited to 'std/dynamic_library.zig')
| -rw-r--r-- | std/dynamic_library.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/std/dynamic_library.zig b/std/dynamic_library.zig index 30e6f4e974..49f217bc8e 100644 --- a/std/dynamic_library.zig +++ b/std/dynamic_library.zig @@ -18,7 +18,7 @@ pub const DynLib = switch (builtin.os) { else => void, }; -pub const LinuxDynLib = struct.{ +pub const LinuxDynLib = struct { allocator: *mem.Allocator, elf_lib: ElfLib, fd: i32, @@ -44,7 +44,7 @@ pub const LinuxDynLib = struct.{ const bytes = @intToPtr([*]align(std.os.page_size) u8, addr)[0..size]; - return DynLib.{ + return DynLib{ .allocator = allocator, .elf_lib = try ElfLib.init(bytes), .fd = fd, @@ -64,7 +64,7 @@ pub const LinuxDynLib = struct.{ } }; -pub const ElfLib = struct.{ +pub const ElfLib = struct { strings: [*]u8, syms: [*]elf.Sym, hashtab: [*]linux.Elf_Symndx, @@ -121,7 +121,7 @@ pub const ElfLib = struct.{ } } - return ElfLib.{ + return ElfLib{ .base = base, .strings = maybe_strings orelse return error.ElfStringSectionNotFound, .syms = maybe_syms orelse return error.ElfSymSectionNotFound, @@ -169,14 +169,14 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ return mem.eql(u8, vername, cstr.toSliceConst(strings + aux.vda_name)); } -pub const WindowsDynLib = struct.{ +pub const WindowsDynLib = struct { allocator: *mem.Allocator, dll: windows.HMODULE, pub fn open(allocator: *mem.Allocator, path: []const u8) !WindowsDynLib { const wpath = try win_util.sliceToPrefixedFileW(path); - return WindowsDynLib.{ + return WindowsDynLib{ .allocator = allocator, .dll = windows.LoadLibraryW(&wpath) orelse { const err = windows.GetLastError(); |
