Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/std/dynamic_library.zig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ pub const DynLib = struct {
}

pub fn lookup(self: *DynLib, comptime T: type, name: [:0]const u8) ?T {
switch (@typeInfo(T)) {
.Pointer => |pointer| {
switch (@typeInfo(pointer.child)) {
.Fn => |function| {
if (function.calling_convention == .Unspecified) {
@compileError("callconv cannot be .Unspecified for: " ++ @typeName(T));
}
},
else => {},
}
},
else => @compileError("expected a pointer type"),
}
return self.inner.lookup(T, name);
}
};
Expand Down
Loading