aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred SUmner <jarred@jarredsumner.com> 2023-01-01 07:20:35 -0800
committerGravatar Jarred SUmner <jarred@jarredsumner.com> 2023-01-01 07:20:35 -0800
commitc02b921983c802db7aa140ade0b744a31e2a494a (patch)
tree06ba95a86d7a2bbe465d1e3f9c43a1da822bd527
parent0b0aadfc5fb2d09b561a8f7f5d46afe68c8e7284 (diff)
downloadbun-c02b921983c802db7aa140ade0b744a31e2a494a.tar.gz
bun-c02b921983c802db7aa140ade0b744a31e2a494a.tar.zst
bun-c02b921983c802db7aa140ade0b744a31e2a494a.zip
Fix linux build issue
-rw-r--r--src/c.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/c.zig b/src/c.zig
index 9385c5654..6e1a8632f 100644
--- a/src/c.zig
+++ b/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 {