diff options
author | 2023-01-01 07:20:35 -0800 | |
---|---|---|
committer | 2023-01-01 07:20:35 -0800 | |
commit | c02b921983c802db7aa140ade0b744a31e2a494a (patch) | |
tree | 06ba95a86d7a2bbe465d1e3f9c43a1da822bd527 | |
parent | 0b0aadfc5fb2d09b561a8f7f5d46afe68c8e7284 (diff) | |
download | bun-c02b921983c802db7aa140ade0b744a31e2a494a.tar.gz bun-c02b921983c802db7aa140ade0b744a31e2a494a.tar.zst bun-c02b921983c802db7aa140ade0b744a31e2a494a.zip |
Fix linux build issue
-rw-r--r-- | src/c.zig | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 { |