MCPcopy Create free account
hub / github.com/hashintel/hash / open

Method open

libs/darwin-kperf/sys/src/load.rs:102–112  ·  view source on GitHub ↗

Loads the dynamic library at `path` with `RTLD_LAZY` binding. Returns a handle that keeps the library mapped until it is closed or dropped. # Errors Returns [`LoadError`] if the library cannot be loaded.

(path: &CStr)

Source from the content-addressed store, hash-verified

100 ///
101 /// Returns [`LoadError`] if the library cannot be loaded.
102 pub fn open(path: &CStr) -> Result<Self, LoadError> {
103 // SAFETY: `path` is a valid, null-terminated C string.
104 let ptr = unsafe { dlopen(path.as_ptr(), RTLD_LAZY) };
105 let Some(ptr) = NonNull::new(ptr) else {
106 // SAFETY: `dlerror` is guaranteed to return a valid C string
107 let message = unsafe { CStr::from_ptr(dlerror()).to_owned() };
108 return Err(LoadError { message });
109 };
110
111 Ok(Self(Some(ptr)))
112 }
113
114 /// Resolves a named symbol from the loaded library.
115 ///

Callers 15

submitConsentFormFunction · 0.80
createRenderUrlCellFunction · 0.80
BlockHandleFunction · 0.80
openUrlFunction · 0.80
reqFunction · 0.80
PropertyFilterPillFunction · 0.80
onCreateNewFunction · 0.80
value-cell.tsxFile · 0.80
CommandBarFunction · 0.80
page-tree-item.tsxFile · 0.80
runFunction · 0.80

Calls 3

ErrInterface · 0.85
OkInterface · 0.85
to_ownedMethod · 0.45

Tested by 4

indexFunction · 0.64
indexFunction · 0.64
indexFunction · 0.64
indexFunction · 0.64