diff options
Diffstat (limited to 'bindgen/codegen/dyngen.rs')
-rw-r--r-- | bindgen/codegen/dyngen.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bindgen/codegen/dyngen.rs b/bindgen/codegen/dyngen.rs index d02c51e4..f310f14e 100644 --- a/bindgen/codegen/dyngen.rs +++ b/bindgen/codegen/dyngen.rs @@ -92,7 +92,9 @@ impl DynamicItems { ) -> Result<Self, ::libloading::Error> where P: AsRef<::std::ffi::OsStr> { let library = ::libloading::Library::new(path)?; - Self::from_library(library) + unsafe { + Self::from_library(library) + } } pub unsafe fn from_library<L>( @@ -157,7 +159,9 @@ impl DynamicItems { self.struct_implementation.push(quote! { #(#attributes)* pub unsafe fn #ident ( &self, #( #args ),* ) -> #ret_ty { - #call_body + unsafe { + #call_body + } } }); } @@ -166,11 +170,11 @@ impl DynamicItems { let ident_str = codegen::helpers::ast_ty::cstr_expr(ident.to_string()); self.constructor_inits.push(if is_required { quote! { - let #ident = __library.get(#ident_str).map(|sym| *sym)?; + let #ident = unsafe { __library.get(#ident_str) }.map(|sym| *sym)?; } } else { quote! { - let #ident = __library.get(#ident_str).map(|sym| *sym); + let #ident = unsafe { __library.get(#ident_str) }.map(|sym| *sym); } }); |