mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Updated Linux standard library to convert c strs
This commit is contained in:
+3
-11
@@ -199,24 +199,16 @@ current_thread_id :: proc() -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dlopen :: proc(filename: string, flags: int) -> rawptr #inline {
|
dlopen :: proc(filename: string, flags: int) -> rawptr #inline {
|
||||||
filename += "\x00";
|
return unix_dlopen(to_c_str(filename), flags);
|
||||||
return unix_dlopen(filename.data, flags);
|
|
||||||
}
|
}
|
||||||
dlsym :: proc(handle: rawptr, symbol: string) -> (proc() #cc_c) #inline {
|
dlsym :: proc(handle: rawptr, symbol: string) -> (proc() #cc_c) #inline {
|
||||||
assert(handle != nil);
|
assert(handle != nil);
|
||||||
symbol += "\x00";
|
return unix_dlsym(handle, to_c_str(symbol));
|
||||||
return unix_dlsym(handle, symbol.data);
|
|
||||||
}
|
}
|
||||||
dlclose :: proc(handle: rawptr) -> bool #inline {
|
dlclose :: proc(handle: rawptr) -> bool #inline {
|
||||||
assert(handle != nil);
|
assert(handle != nil);
|
||||||
return unix_dlclose(handle) == 0;
|
return unix_dlclose(handle) == 0;
|
||||||
}
|
}
|
||||||
dlerror :: proc() -> string {
|
dlerror :: proc() -> string {
|
||||||
// TODO(zangent): Should this be split out into a from_c_string()?
|
return from_c_str(unix_dlerror());
|
||||||
c_str := unix_dlerror();
|
|
||||||
len := 0;
|
|
||||||
for s := c_str; s^ != 0; s += 1 {
|
|
||||||
len += 1;
|
|
||||||
}
|
|
||||||
return cast(string)slice_ptr(c_str, len);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user