| author | |
| committer | |
| log | 80882bda59427077c141791178b5680fc346eea0 |
| tree | 014b5afba03f2686b7e804dabe6d1d6b7d5d716f |
| parent | fd6b7b160d1fddf967177cf26704908aa7bf5f12 |
| signature | Commit is signed but in an unrecognized format. |
2 files changed, 2 insertions(+), 3 deletions(-)
lib/std/dynamic_library.zig+1-1| ... | ... | @@ -144,7 +144,7 @@ pub const LinuxDynLib = struct { |
| 144 | 144 | |
| 145 | 145 | pub fn lookup(self: *LinuxDynLib, comptime T: type, name: []const u8) ?T { |
| 146 | 146 | if (self.elf_lib.lookup("", name)) |symbol| { |
| 147 | return @ptrCast(T, symbol); | |
| 147 | return @intToPtr(T, symbol); | |
| 148 | 148 | } else { |
| 149 | 149 | return null; |
| 150 | 150 | } |
test/standalone/load_dynamic_library/main.zig+1-2| ... | ... | @@ -9,8 +9,7 @@ pub fn main() !void { |
| 9 | 9 | var lib = try std.DynLib.open(dynlib_name); |
| 10 | 10 | defer lib.close(); |
| 11 | 11 | |
| 12 | const addr = lib.lookup("add") orelse return error.SymbolNotFound; | |
| 13 | const addFn = @intToPtr(extern fn (i32, i32) i32, addr); | |
| 12 | const addFn = lib.lookup(extern fn (i32, i32) i32, "add") orelse return error.SymbolNotFound; | |
| 14 | 13 | |
| 15 | 14 | const result = addFn(12, 34); |
| 16 | 15 | std.debug.assert(result == 46); |