aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda_dump/src/os_unix.rs
diff options
context:
space:
mode:
Diffstat (limited to 'zluda_dump/src/os_unix.rs')
-rw-r--r--zluda_dump/src/os_unix.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/zluda_dump/src/os_unix.rs b/zluda_dump/src/os_unix.rs
new file mode 100644
index 0000000..b3d9343
--- /dev/null
+++ b/zluda_dump/src/os_unix.rs
@@ -0,0 +1,14 @@
+use std::ffi::{c_void, CStr};
+
+const NVCUDA_DEFAULT_PATH: &'static [u8] = b"/usr/lib/x86_64-linux-gnu/libcuda.so.1\0";
+
+pub unsafe fn load_cuda_library() -> *mut c_void {
+ libc::dlopen(
+ NVCUDA_DEFAULT_PATH.as_ptr() as *const _,
+ libc::RTLD_LOCAL | libc::RTLD_NOW,
+ )
+}
+
+pub unsafe fn get_proc_address(handle: *mut c_void, func: &CStr) -> *mut c_void {
+ libc::dlsym(handle, func.as_ptr() as *const _)
+}