mirror of
https://github.com/openharmony/third_party_rust_libloading.git
synced 2026-07-21 00:26:36 -04:00
Fix windows build
No idea why it was failing. Weird stuff
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
||||
use util::{self, cstr_cow_from_bytes};
|
||||
use util::{ensure_compatible_types, cstr_cow_from_bytes};
|
||||
|
||||
use std::ffi::{CStr, OsStr};
|
||||
use std::{fmt, io, marker, mem, ptr};
|
||||
@@ -147,7 +147,7 @@ impl Library {
|
||||
/// OS X uses some sort of lazy initialization scheme, which makes loading TLS variables
|
||||
/// impossible. Using a TLS variable loaded this way on OS X is undefined behaviour.
|
||||
pub unsafe fn get<T>(&self, symbol: &[u8]) -> ::Result<Symbol<T>> {
|
||||
util::ensure_compatible_types::<T, *mut raw::c_void>();
|
||||
ensure_compatible_types::<T, *mut raw::c_void>();
|
||||
let symbol = try!(cstr_cow_from_bytes(symbol));
|
||||
// `dlsym` may return nullptr in two cases: when a symbol genuinely points to a null
|
||||
// pointer or the symbol cannot be found. In order to detect this case a double dlerror
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extern crate winapi;
|
||||
extern crate kernel32;
|
||||
|
||||
use util::cstr_cow_from_bytes;
|
||||
use util::{ensure_compatible_types, cstr_cow_from_bytes};
|
||||
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::{fmt, io, marker, mem, ptr};
|
||||
@@ -68,7 +68,7 @@ impl Library {
|
||||
/// Pointer to a value of arbitrary type is returned. Using a value with wrong type is
|
||||
/// undefined.
|
||||
pub unsafe fn get<T>(&self, symbol: &[u8]) -> ::Result<Symbol<T>> {
|
||||
util::ensure_compatible_types::<T, winapi::FARPROC>();
|
||||
ensure_compatible_types::<T, winapi::FARPROC>();
|
||||
let symbol = try!(cstr_cow_from_bytes(symbol));
|
||||
with_get_last_error(|| {
|
||||
let symbol = kernel32::GetProcAddress(self.0, symbol.as_ptr());
|
||||
@@ -92,7 +92,7 @@ impl Library {
|
||||
/// Pointer to a value of arbitrary type is returned. Using a value with wrong type is
|
||||
/// undefined.
|
||||
pub unsafe fn get_ordinal<T>(&self, ordinal: winapi::WORD) -> ::Result<Symbol<T>> {
|
||||
util::ensure_compatible_types::<T, winapi::FARPROC>();
|
||||
ensure_compatible_types::<T, winapi::FARPROC>();
|
||||
with_get_last_error(|| {
|
||||
let ordinal = ordinal as usize as *mut _;
|
||||
let symbol = kernel32::GetProcAddress(self.0, ordinal);
|
||||
|
||||
Reference in New Issue
Block a user