blob: 49fdc4c0736a5ea2817c0995802d9d741f675ebf [file] [log] [blame]
diff --git a/Cargo.toml b/Cargo.toml
index 1da2ac4..4af7f4d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,7 +31,7 @@ version = "0.2.39"
default-features = false
[dependencies.libloading]
-version = "0.6"
+version = "0.7"
optional = true
[build-dependencies.glob]
version = "0.3"
diff --git a/src/link.rs b/src/link.rs
index 3230e4a..64a3528 100644
--- a/src/link.rs
+++ b/src/link.rs
@@ -195,17 +195,19 @@ macro_rules! link {
let (directory, filename) = build::dynamic::find(true)?;
let path = directory.join(filename);
- let library = libloading::Library::new(&path).map_err(|e| {
- format!(
- "the `libclang` shared library at {} could not be opened: {}",
- path.display(),
- e,
- )
- });
+ unsafe {
+ let library = libloading::Library::new(&path).map_err(|e| {
+ format!(
+ "the `libclang` shared library at {} could not be opened: {}",
+ path.display(),
+ e,
+ )
+ });
- let mut library = SharedLibrary::new(library?, path);
- $(load::$name(&mut library);)+
- Ok(library)
+ let mut library = SharedLibrary::new(library?, path);
+ $(load::$name(&mut library);)+
+ Ok(library)
+ }
}
/// Loads a `libclang` shared library for use in the current thread.