File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,7 @@ dlib = { path = "../" }
1010lazy_static = { version = " 1.0" , optional = true }
1111
1212[features ]
13- "dlopen" = [" lazy_static" ]
13+ default = [" sin" ]
14+ sin = []
15+ nonexistant = []
16+ dlopen = [" lazy_static" ]
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ use dlib::external_library;
33external_library ! ( Mlib , "m" ,
44 functions:
55 fn cos( f64 ) -> f64 ,
6+ #[ cfg( feature = "sin" ) ]
7+ fn sin( f64 ) -> f64 ,
8+ #[ cfg( feature = "nonexistant" ) ]
9+ fn nonexistant_function( f64 ) -> f64 ,
610) ;
711
812#[ cfg( feature = "dlopen" ) ]
@@ -20,5 +24,14 @@ mod tests {
2024 let angle = 1.8 ;
2125 let cosinus = unsafe { ffi_dispatch ! ( M_STATIC , cos, angle) } ;
2226 assert_eq ! ( cosinus, angle. cos( ) ) ;
27+
28+ }
29+
30+ #[ cfg( feature = "sin" ) ]
31+ #[ test]
32+ fn invoke_sin ( ) {
33+ let angle = 1.8 ;
34+ let sine = unsafe { ffi_dispatch ! ( M_STATIC , sin, angle) } ;
35+ assert_eq ! ( sine, angle. sin( ) ) ;
2336 }
2437}
You can’t perform that action at this time.
0 commit comments