blob: 49fdc4c0736a5ea2817c0995802d9d741f675ebf [file] [log] [blame]
Jeff Vander Stoep582dabe2021-02-19 19:59:49 +01001diff --git a/Cargo.toml b/Cargo.toml
2index 1da2ac4..4af7f4d 100644
3--- a/Cargo.toml
4+++ b/Cargo.toml
5@@ -31,7 +31,7 @@ version = "0.2.39"
6 default-features = false
7
8 [dependencies.libloading]
9-version = "0.6"
10+version = "0.7"
11 optional = true
12 [build-dependencies.glob]
13 version = "0.3"
14diff --git a/src/link.rs b/src/link.rs
15index 3230e4a..64a3528 100644
16--- a/src/link.rs
17+++ b/src/link.rs
18@@ -195,17 +195,19 @@ macro_rules! link {
19 let (directory, filename) = build::dynamic::find(true)?;
20 let path = directory.join(filename);
21
22- let library = libloading::Library::new(&path).map_err(|e| {
23- format!(
24- "the `libclang` shared library at {} could not be opened: {}",
25- path.display(),
26- e,
27- )
28- });
29+ unsafe {
30+ let library = libloading::Library::new(&path).map_err(|e| {
31+ format!(
32+ "the `libclang` shared library at {} could not be opened: {}",
33+ path.display(),
34+ e,
35+ )
36+ });
37
38- let mut library = SharedLibrary::new(library?, path);
39- $(load::$name(&mut library);)+
40- Ok(library)
41+ let mut library = SharedLibrary::new(library?, path);
42+ $(load::$name(&mut library);)+
43+ Ok(library)
44+ }
45 }
46
47 /// Loads a `libclang` shared library for use in the current thread.