Skip to content

Commit 08c9ff7

Browse files
author
Jorge Aparicio
committed
osx: link to dylib, windows: always return None
1 parent 9493c37 commit 08c9ff7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

gcc_s/src/lib.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,34 @@ use libloading::Library;
88

99
static mut GCC_S: Option<Library> = None;
1010

11+
#[cfg(not(windows))]
1112
fn gcc_s() -> &'static Library {
13+
#[cfg(not(target_os = "macos"))]
14+
const LIBGCC_S: &'static str = "libgcc_s.so.1";
15+
16+
#[cfg(target_os = "macos")]
17+
const LIBGCC_S: &'static str = "libgcc_s.1.dylib";
18+
1219
unsafe {
1320
static INIT: Once = ONCE_INIT;
1421

1522
INIT.call_once(|| {
16-
GCC_S = Some(Library::new("libgcc_s.so.1").unwrap());
23+
GCC_S = Some(Library::new(LIBGCC_S).unwrap());
1724
});
1825
GCC_S.as_ref().unwrap()
1926
}
2027
}
2128

29+
#[cfg(windows)]
30+
macro_rules! declare {
31+
($symbol:ident: fn($($i:ty),+) -> $o:ty) => {
32+
pub fn $symbol() -> Option<unsafe extern fn($($i),+) -> $o> {
33+
None
34+
}
35+
}
36+
}
37+
38+
#[cfg(not(windows))]
2239
macro_rules! declare {
2340
($symbol:ident: fn($($i:ty),+) -> $o:ty) => {
2441
pub fn $symbol() -> Option<unsafe extern fn($($i),+) -> $o> {

0 commit comments

Comments
 (0)