mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 21:32:05 +00:00
Fix linux build issue
This commit is contained in:
10
src/c.zig
10
src/c.zig
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user