Fix windows build

No idea why it was failing. Weird stuff
This commit is contained in:
Simonas Kazlauskas
2017-03-25 00:13:50 +02:00
parent ac815d27b6
commit 2e7edc2d39
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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);