Fix linux build issue

This commit is contained in:
Jarred SUmner
2023-01-01 07:20:35 -08:00
parent 0b0aadfc5f
commit c02b921983

View File

@@ -393,9 +393,13 @@ const LazyStatus = enum {
failed,
};
pub fn dlsym(comptime Type: type, comptime name: [:0]const u8) ?*const Type {
pub fn dlsym(comptime Type: type, comptime name: [:0]const u8) ?Type {
if (comptime @typeInfo(Type) != .Pointer) {
@compileError("dlsym must be a pointer type (e.g. ?const *fn()). Received " ++ @typeName(Type) ++ ".");
}
const Wrapper = struct {
pub var function: *const Type = undefined;
pub var function: Type = undefined;
pub var loaded: LazyStatus = LazyStatus.pending;
};
@@ -407,7 +411,7 @@ pub fn dlsym(comptime Type: type, comptime name: [:0]const u8) ?*const Type {
const result = std.c.dlsym(RTLD_DEFAULT, name);
if (result) |ptr| {
Wrapper.function = bun.cast(*const Type, ptr);
Wrapper.function = bun.cast(Type, ptr);
Wrapper.loaded = .loaded;
return Wrapper.function;
} else {