aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-12-10 12:56:05 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-12-10 12:56:05 -0500
commit3ef8460d0646dbf0e762cbd7e0728fc2026d2001 (patch)
tree77d1dc25c3a2ed9629a136897b2dc08af2fd7c44
parent80882bda59427077c141791178b5680fc346eea0 (diff)
downloadzig-3ef8460d0646dbf0e762cbd7e0728fc2026d2001.tar.gz
zig-3ef8460d0646dbf0e762cbd7e0728fc2026d2001.zip
fix load dynamic library API when linking libc
-rw-r--r--lib/std/dynamic_library.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig
index 154858586c..347491a44c 100644
--- a/lib/std/dynamic_library.zig
+++ b/lib/std/dynamic_library.zig
@@ -142,7 +142,7 @@ pub const LinuxDynLib = struct {
self.* = undefined;
}
- pub fn lookup(self: *LinuxDynLib, comptime T: type, name: []const u8) ?T {
+ pub fn lookup(self: *LinuxDynLib, comptime T: type, name: [:0]const u8) ?T {
if (self.elf_lib.lookup("", name)) |symbol| {
return @intToPtr(T, symbol);
} else {
@@ -292,7 +292,7 @@ pub const WindowsDynLib = struct {
self.* = undefined;
}
- pub fn lookup(self: *DlDynlib, comptime T: type, name: [:0]const u8) ?T {
+ pub fn lookup(self: *WindowsDynLib, comptime T: type, name: [:0]const u8) ?T {
if (windows.kernel32.GetProcAddress(self.dll, name.ptr)) |addr| {
return @ptrCast(T, addr);
} else {
@@ -324,7 +324,7 @@ pub const DlDynlib = struct {
self.* = undefined;
}
- pub fn lookup(self: *DlDynlib, comptime T: type, name: [*:0]const u8) ?T {
+ pub fn lookup(self: *DlDynlib, comptime T: type, name: [:0]const u8) ?T {
// dlsym (and other dl-functions) secretly take shadow parameter - return address on stack
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826
if (@call(.{ .modifier = .never_tail }, system.dlsym, .{ self.handle, name.ptr })) |symbol| {