osx: link to dylib, windows: always return None
This commit is contained in:
parent
9493c37455
commit
08c9ff730c
@ -8,17 +8,34 @@ use libloading::Library;
|
|||||||
|
|
||||||
static mut GCC_S: Option<Library> = None;
|
static mut GCC_S: Option<Library> = None;
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
fn gcc_s() -> &'static Library {
|
fn gcc_s() -> &'static Library {
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
const LIBGCC_S: &'static str = "libgcc_s.so.1";
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
const LIBGCC_S: &'static str = "libgcc_s.1.dylib";
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
static INIT: Once = ONCE_INIT;
|
static INIT: Once = ONCE_INIT;
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
GCC_S = Some(Library::new("libgcc_s.so.1").unwrap());
|
GCC_S = Some(Library::new(LIBGCC_S).unwrap());
|
||||||
});
|
});
|
||||||
GCC_S.as_ref().unwrap()
|
GCC_S.as_ref().unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
macro_rules! declare {
|
||||||
|
($symbol:ident: fn($($i:ty),+) -> $o:ty) => {
|
||||||
|
pub fn $symbol() -> Option<unsafe extern fn($($i),+) -> $o> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
macro_rules! declare {
|
macro_rules! declare {
|
||||||
($symbol:ident: fn($($i:ty),+) -> $o:ty) => {
|
($symbol:ident: fn($($i:ty),+) -> $o:ty) => {
|
||||||
pub fn $symbol() -> Option<unsafe extern fn($($i),+) -> $o> {
|
pub fn $symbol() -> Option<unsafe extern fn($($i),+) -> $o> {
|
||||||
|
Loading…
Reference in New Issue
Block a user