File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,34 @@ use libloading::Library;
8
8
9
9
static mut GCC_S : Option < Library > = None ;
10
10
11
+ #[ cfg( not( windows) ) ]
11
12
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
+
12
19
unsafe {
13
20
static INIT : Once = ONCE_INIT ;
14
21
15
22
INIT . call_once ( || {
16
- GCC_S = Some ( Library :: new ( "libgcc_s.so.1" ) . unwrap ( ) ) ;
23
+ GCC_S = Some ( Library :: new ( LIBGCC_S ) . unwrap ( ) ) ;
17
24
} ) ;
18
25
GCC_S . as_ref ( ) . unwrap ( )
19
26
}
20
27
}
21
28
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) ) ]
22
39
macro_rules! declare {
23
40
( $symbol: ident: fn ( $( $i: ty) ,+) -> $o: ty) => {
24
41
pub fn $symbol( ) -> Option <unsafe extern fn ( $( $i) ,+) -> $o> {
You can’t perform that action at this time.
0 commit comments